Thanks for the greater detail. I think I’ve got a potential solution for your first question, but it will require a small bit of logic. It will be a two part step, you will first need to gather which role(s) are being targeted by an action with
Octopus.Action.TargetRoles, then you will need to output the machines in the role with
Octopus.Environment.MachinesInRole[\_role\_]. The complication will come in when you have multiple roles being targeted by an action. You will need to include logic to iterate through all of the target roles and run the 2nd command for each role that was targeted. Links to the specific spots for these 2 commands are here and here.
For your second question, if you mean step type, you can get more information about a particular action by using API calls to drill down into your deployment process and filter based on the information you’d like to get. Here is a PowerShell script for cloning a deployment process. We don’t want to clone the deployment process, but it has the logic in there to get access to the deployment process to parse through the data. The easiest way to figure out exactly how the JSON you’re pulling down is structured would be to take a look at the JSON in your web browser by just going to the URL that you do the API call with, for example
https://yourserverurl/api/projects/all . You can then see what sort of information in the deployment process is there for you to gather. If it was more information about the machine you want to gather, you can also get more information about a particular machine from API calls. You can examine that information by navigating to
Please let me know if this will work for you or if you need further assistance.