Hello,
On my project, we perform on daily basis actions into an Windows AWS EC2 instance using a tentacle. After all the actions are done, we create an AMI that is used later on as a base for our different servers. What we have faced is that when we create a new instance base in the base AMI and we want to perform specific actions using a tentacle, the tentacle has already a thumbprint that is equal to the thumbprint of the base AMI. That is an issue because when we deregister the tentacle we deregister other tentacles with the same thumbprint.
This is the script that we use to configure the tentacles:
choco uninstall octopusdeploy.tentacle -y
choco install octopusdeploy.tentacle -y --version $tentacleVersion$ipAddress = (Get-NetAdapter | ? status -eq ‘up’ | Get-NetIPAddress -ea 0 | ? addressfamily -eq ‘IPv4’).IPAddress
cd “${env:ProgramFiles}\Octopus Deploy\Tentacle”
& .\Tentacle.exe create-instance --instance “Tentacle” --config $tentacleConfigFile --console
& .\Tentacle.exe new-certificate --instance “Tentacle” --if-blank --console
& .\Tentacle.exe configure --instance “Tentacle” --trust $octopusServerThumbprint --console
& .\Tentacle.exe configure --instance “Tentacle” --home $tentacleHomeDirectory --console
& .\Tentacle.exe configure --instance “Tentacle” --app $tentacleAppDirectory --console
& .\Tentacle.exe configure --instance “Tentacle” --port $tentacleListenPort --noListen “True” --console
& .\Tentacle.exe register-with --instance “Tentacle” --server $octopusServerUrl --environment $environment --role $role --name $env:COMPUTERNAME --publicHostName $ipAddress --apiKey $apiKey --comms-style TentacleActive --policy ‘Time&Roster Automatic machines clean up’ --force --console
& .\Tentacle.exe service --instance “Tentacle” --install --start --console
We use the next command to deregister the tentacle once all the needed actions are performed
cd “${env:ProgramFiles}\Octopus Deploy\Tentacle”
& .\Tentacle.exe deregister-from --instance “Tentacle” --server $OctopusParameters[“Tentacle.OctopusServerUrl”] --apiKey $OctopusParameters[“Tentacle.ApiKey”] --multiple --console
Which would be the best way to handle this situation? could be possible to modify the thumbprint of the new servers?
I tried using the new-certificate command without the --if-blank option as indicated below
& .\Tentacle.exe new-certificate --instance “Tentacle” --console
However, when I do this, the register command did not work and we have the next error
Could not find a part of the path ‘C:\Windows\system32\config\systemprofile\AppData\Local\Temp\Octo-45fe21a0-a24c-4db6-a139-ac3933a1c555’.
System.IO.DirectoryNotFoundException: Could not find a part of the path ‘C:\Windows\system32\config\systemprofile\AppData\Local\Temp\Octo-45fe21a0-a24c-4db6-a139-ac3933a1c555’.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.File.InternalDelete(String path, Boolean checkHost)
at Octopus.Shared.Security.Certificates.CertificateEncoder.DoFromBase64String(String thumbprint, String certificateString, X509Store store) in Y:\Work\refs\tags\3.3.26\source\Octopus.Shared\Security\Certificates\CertificateEncoder.cs:line 108
at Octopus.Shared.Configuration.TentacleConfiguration.get_TentacleCertificate() in Y:\Work\refs\tags\3.3.26\source\Octopus.Shared\Configuration\TentacleConfiguration.cs:line 97
at Octopus.Tentacle.Commands.RegisterMachineCommand.Start() in Y:\Work\refs\tags\3.3.26\source\Octopus.Tentacle\Commands\RegisterMachineCommand.cs:line 65
at Octopus.Shared.Startup.AbstractCommand.Octopus.Shared.Startup.ICommand.Start(String commandLineArguments, ICommandRuntime commandRuntime, OptionSet commonOptions) in Y:\Work\refs\tags\3.3.26\source\Octopus.Shared\Startup\AbstractCommand.cs:line 58
at Octopus.Shared.Startup.OctopusProgram.Start(ICommandRuntime commandRuntime) in Y:\Work\refs\tags\3.3.26\source\Octopus.Shared\Startup\OctopusProgram.cs:line 221
at Octopus.Shared.Startup.ConsoleHost.Run(Action`1 start, Action shutdown) in Y:\Work\refs\tags\3.3.26\source\Octopus.Shared\Startup\ConsoleHost.cs:line 72
at Octopus.Shared.Startup.OctopusProgram.Run() in Y:\Work\refs\tags\3.3.26\source\Octopus.Shared\Startup\OctopusProgram.cs:line 94
Could you please with this case?
Thank you very much in advance.