Bulk add role to all deployment targets

Is there a way to bulk add a role to all deployment targets we have ~175 odd machines at the moment so to add the role by hand to each one would take a while.

Background: We use Octopus roles as tag names in other monitoring applications as we like the consistency it gives across our estate. However, we are just about to add a load of new machines that we want to differentiate from the original in both Octopus and other apps. Hence setting a “Original” role name in bulk across the current.

Hi Marcus,

You should be able to do this easily with some API Calls. I found an example in our examples repository that adds a role to a single target. You could modify it to loop and apply to all the machines you want to add the role to. I would test it and evaluate the results and make sure they are the desired outcome before you actually do the API call to put them back. Please let me know if it works for you or if you need more assistance.


Along with finding the swagger link, that worked perfectly.

Hey Marcus,

Glad to hear you got it working! I appreciate you letting me know.


This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.