Automatically update deployment target names?


we have a number of deployment targets set up in octopus. we’re changing the hostname and domain name for many of them, and i’d like to know whether there’s a way to get the tentacle to update its target name in octopus, rather than having to go through the “infrastructure” page and manually update their names.

for example, we have: through – they’re now named, and so forth.

is there an option or tool to get octopus to recognize and update these targets’ new hostnames and and domain suffixes? we have like 150+ servers, so doing it manually would be really time-consuming.

thank you.

Hi @ariehm,

Thanks for reaching out.

I think your best path forward here is an iterative API call.

You should be able to modify this script to get where you need to go: OctopusDeploy-Api/AddRoleToTarget.ps1 at master · OctopusDeploy/OctopusDeploy-Api · GitHub

Instead of pulling down one specific machine with the where-object modifier, bring them all down and iterate through them.

In a forloop for each machine, instead of adding a role, you would need to implement logic to modify the name of the machine to add the hyphen (if that is the only change you’re making) to the name and put the machine back in place with a POST call.

Please read the script and test thoroughly before putting it into a production environment, as the scripts we have in our repository are not guaranteed to work in all scenarios.

Please let me know if that works for you or if we need to try something different.


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