Can you please help in knowing how the octopus will know whether it is deploying to windows or Linux environment automatically when given the commands through the script. Is there any way octopus can identify to which os target it is deploying the patch.??
Octopus has system variables available during deployments.
Some that may help you are:
- Octopus.Action[action name].xxx
Hope this helps
Here with me the case is that I am having the powershell script for windows server and bash script for Linux server. And I am having multiple environment with both of this OS. I don’t know Which Os is installed in which host. I have to automate through script so that octopus can identify itself to deploy patches automatically to this both Os with the help of the scripts. Is this possible with octopus. Also I cannot upgrade to the latest version of Octopus.
Thanks for getting in touch! Octopus doesn’t usually care exactly what operating system is installed on the target when executing the deployment. The Tentacle is generally responsible for this. I think the best way you could manage this would be to try and identify which targets are running which OS and create Machine Roles for them in Octopus.
For example, your windows targets could all be tagged with the role
System.Windows and your Linux targets
System.Linux. This would allow you to use scoping in Octopus to define which steps or scripts are executed on the given target.
You can use one of the above mentioned system roles such as
Octopus.Machine.Roles to have Octopus return which roles are associated with the target you are currently executing your scripts on. A custom script could then be used to decide whether the target contains the desired
Does this help in your scenario?
Let me know if you still have any questions here.