Determine the O/S and version of the tentacle host

Is there a tentacle variable that contains information about the O/S and version for the server it is install on?

I need to deploy an app that is built in .NET Core. I just need to make sure that I deploy the correct version of Core depending upon the server’s OS. For example, if the server is Windows 2008 R2, than I will need to deploy .NET Core 2.2. If it is Debian 8, I can’t deploy Core.

The goal is to have the tentacle report the OS version back to the deployment script. Then the script will determine which Core package to deploy to the server.

Thanks

Hi Marcs,

Thanks for getting in touch! This information is surfaced in the task log, though unfortunately Octopus doesn’t create a variable to call with this information populated in it for usage like this. It looks like you’d probably need to do something like the following to create an output variable in Step 1 calling these environment variables.

$osversion = [System.Environment]::OSVersion
set-octopusvariable -name "os" -value $osversion

Then you can call it wherever needed to perform some logic in a subsequent step with this syntax.

#{octopus.action[Step1].output.os}

I hope that helps! Let me know how you go or if you have any further questions going forward. :slight_smile:

Best regards,

Kenny

Thanks.

Hi Marcs,

You’re quite welcome. Please let us know if you have any questions in the future. :slight_smile:

Best regards,

Kenny