How can I change the address tentacles use to communicate with the server? I’m currently using octo.companyA.com and need to update it to octopus.companyB.com. I have a few tentacles setup (and limited access to them) and I’d prefer not to uninstall/reinstall all the tentacles. Is it possible to run something from the script console to update all tentacles at once? Thanks for your help!
Hello, thanks for getting in touch! One option which comes to mind could be to use
Tentacle.exe command line tool to complete the task of registering your Octopus Tentacle against a new server without uninstalling and reinstalling it.
By default, the
Tentacle.exe command line tool lives in
C:\Program Files\Octopus Deploy\Tentacle
In this case you could run a script that completes these tasks:
- Stops the Tentacle service so that we can make these changes.
- Configures your Tentacle to trust the thumbprint of the new Octopus Server that you’re planning to move it to.
- Register your Tentacle against he new Octopus Server.
- Please keep in mind that we must provide an environment and role that exists on the new Octopus Server.
- Start the Tentacle
One other thing to keep in mind is that it’s possible for a Tentacle to trust multiple Octopus Servers, so in addition to removing your Tentacle from the old server, you could run the
Tentacle configure --reset-trust command to clear the list of thumbprints before you run the
--trust parameter below.
An example of this taking place on a Listening Tentacle would look like this (please change values as necessary):
Tentacle service --stop Tentacle.exe configure --trust "<thumbprints-of-new-octopus-server>" Tentacle register-with --server="https://hostname-new-octopus-server" --apikey="API-xxxxxxxxxxxxxxxx" --environment="EnvironmentOnNewServer" --role="Tentacle-Role" Tentacle service --start
I hope this has been helpful, I look forward to hearing how this goes.
Is it possible to stop the tentacle in a script run from the Octopus server’s script console? I haven’t tested, but initially assumed that would prevent the remote machine from being able to run the command.
Also, in case it matters, I’m looking to change the name of the existing server, not migrate it to a new server. Are there any potential issues I’ll run into with re-registering a tentacle with a server it’s already registered with?
Thanks again for your help!
Hi, Thanks for keeping in touch and thanks for clarifying those points. I actually didn’t realise you were changing the name of the existing server and I completely forgot you wouldn’t be able to run these commands locally on the Tentacle itself!
I’m interested to know if you have Listening or Polling tentacles in your environment? If you only have Listening Tentacles and you change the IP Address/Hostname of your Octopus Server, you will not need to make any changes within the Octopus Tentacle and everything will continue to work just fine. Please keep in mind that you would still need to ensure your firewall rules were allowing the communication for the new IP addressing though.
But if you have Polling Tentacles in your environment you will need to modify the server which your Polling Tentacle is polling to for communication. Unfortunately there is no clean way of setting this and it will likely cause problems if you attempt to restart an Octopus Tentacle during a deployment.
One potential (though it is not at all ideal) work around could be to use the task console to execute the command below to actually modify the server config. Once the task below is complete you could completely restart the entire server holding the Tentacle which would ensure the Octopus Tentacle gets restarted.
cd "C:\Program Files\Octopus Deploy\Tentacle" & ./Tentacle register-with --server "https://octopus.new-address.com" --comms-style "TentacleActive" --server-comms-port "10943" --apiKey "API-xxxxxxxx" --environment "<environment>" --role "<roles>" --force
--force switch is used in this case because your Octopus Server should already have a Tentacle with the same name and it won’t let you proceed to register this Tentacle without it.
Once the command above completes and your Polling Tentacle is restarted, it will actually ensure that it can poll for instructions from both the existing and the new hostname of your Octopus Server (if you chose not to run
--reset-trust). I’m sorry that this approach is not the most ideal one for you. I look forward to hearing if you have any other questions!
I have a few variables scoped to specific tenants, so I didn’t want to risk losing that by registering them as a new instance. Instead, I found another way by directly modifying the config file that seems to work.
Using the script console to run PS, update the address in config to the new value, with logging of the before and after config.
& "C:\Program Files\Octopus Deploy\Tentacle\Tentacle.exe" show-configuration (Get-Content C:\Octopus\Tentacle.config).replace('octo.oldaddress.com', 'octopus.newaddress.com') | Set-Content C:\Octopus\Tentacle.config & "C:\Program Files\Octopus Deploy\Tentacle\Tentacle.exe" show-configuration
Then restart the tentacle. This will show as failed, but in my handful of tests, the tentacle has come back everytime
& "C:\Program Files\Octopus Deploy\Tentacle\Tentacle.exe" service --stop & "C:\Program Files\Octopus Deploy\Tentacle\Tentacle.exe" service --start
Hello, Thanks for keeping in touch and letting us know how you fixed this one. I’m glad to hear that this method has worked!