Can target roles be mutually exclusive?

usability
(Waustin) #1

Is it possible to have target roles be mutually exclusive?

We have two applications that cannot be installed on the same piece of infrastructure, and want to prevent a target from being tagged with both roles.

(Paul Calvert) #5

Hi,

Thanks for getting in touch. Unfortunately, there isn’t any direct functionality within Octopus that supports this.

However, one way of achieving your goal would be to create a script step to be run at the beginning of the deployment.

This step would retrieve a list of all deployment targets with a specific role using the system variable Octopus.Environment.MachinesInRole[role]. If you retrieve a list for each of the relevant roles, you could then perform a compare and trigger a failure on the identification of duplicate targets.

I hope this helps, please let me know if you run into any problems.

Kind regards,
Paul