Get names of Linux target servers in email


I am working on project to deploy Java application to Linux servers. I want to know the names of target servers and put them in my notification email. I tried #{Octopus.Deployment.SpecificMachines} but got nothing, here is piece of code in email body:

deployed to machines:
#{each machine in Octopus.Deployment.SpecificMachines} machine: #{machine} #{/each}

To do more investigation, I tried some bash script as follows. All echos print out weird string (see attached screenshot), which means that IDs has something but just not readable.

Can someone shed some light? Thanks!

IDs=get_octopusvariable "Octopus.Deployment.SpecificMachines"
echo “machine ids: $IDs”
for m in “${IDs[@]}”; do
echo “machine ID: $m”
IFS=’,’ read -ra ADDR <<< “$IDs”
for i in “${ADDR[@]}”; do
echo “i == $i”

Hi Edward,

Thanks for getting in touch! While we don’t record the machine name as a variable, you can use our output variables to get this information, as long as the reference step is run on all of the machines. This may only work for package steps or anything where an output variable is available.

#{each machine in Octopus.Action[StepName].Output}

Hope that helps!



Hi Kenny,

Thanks for prompt reply.

I tried this but didn’t get machine name back. The value of #{machine} obviously empty.

In my testing pipeline, I start with a dummy step which just echos “hello, world”. The second step is to get target Linux machine names in email. I used the following code :
#{each machine in Octopus.Action[dummy step].Output}

I got empty value back. What should be in the Octopus.Action[dummy step].Output in my instance? Seems not machine’s name.

See the attached screenshot.


Hi Edward,

Thanks for the reply! Using dummy steps won’t create output variables unless you define one manually, and that’s why that didn’t work.

You’ll need to first set an output variable on the dummy step, as shown in the link below:

If you need, you can turn on troubleshooting variables to see if it’s set properly (link shown below). There, you can see what’s available, and it can help you define the step name as well.

Let me know how you go!