I’m developing a deployment process that would interact with load balancer.
As part of the green/blue deployment the script will swap nodes between two load balancer pools active and inactive.
The deployment includes deploying two application components each living in their own pool, thus I have two sets of active and inactive pools: one for each component.
I have variables called
These need to be available from a powershell script step.
I have to separate steps running the same Powershell Script (or Script Module) one of which swap pools for one component and the other swaps the pools for the other. The script gets the pool names to swap from the variables.
The script does not need to be run for each deployment target, we need to run in once (for each component) so I’m running it on the Octopus server.
I define different values for the variables corresponding to the two components:
Var: F5.ActivePoolName: Role: Comp1 Value: PoolActComp1
Var: F5.InactivePoolName: Role: Comp1 Value: PoolInactComp1
Var: F5.ActivePoolName: Role: Comp2 Value: PoolActComp2
Var: F5.InactivePoolName: Role: Comp2 Value: PoolInactComp2
However I seem to be unable to access these from the script.
If I do not use “On behalf of target roles” option in the step setup, the variables are not accessible
If I do use “On behalf of target roles” they are accessible alright and the script works perfectly, but it runs once per deployment target. This is totally not what I want, the whole reason I’m running it on the Octopus Server and not on the targets is because I want it to be run once.
The best workaround I see is to describe two variables:
And pass these to my script at the top of the step. But surely roles were exactly the mechanism to solve that problem? Am I using them improperly? Can I make it work more elegantly than copying the whole variable set per component I’m installing?