System variables for runbooks - Machine Name/ Deployment target

Can’t seem to find anything that documents for runbooks the variables that will be passed in and contain the target a step is running on.

Octopus.Machine.Name doesn’t appear to be set for a runbook execution? Am i missing something here, is the name of the host we are running on set for runbooks anywhere?

Hi Paul,

Thanks for getting in touch! That certainly doesn’t sound like the correct behavior - sorry about the confusion!

I gave this a test in my instance (v2023.1.8263) and the Octopus.Machine.Name variable seems to be available and evaluates just fine in my case. A simple write-host #{Octopus.Machine.Name} in a script step in my runbook wrote the machine name the step was run on to the log as expected.

A great way to help debug issues like this is to add debugging variables to your project (OctopusPrintVariables & OctopusPrintEvaluatedVariables, both with a value of True), then create and deploy a new release (or in the case of runbooks, run the brand new snapshot) to apply the change, and the task log will contain a lot more verbosity, including all variables before and after step execution.

I’d be happy to have a look at the log if that’d be helpful. Feel free to upload it to this secure upload link or email us at support@octopus.com and I can grab it from there. :slight_smile:

Best regards,

Kenny