Set Tentacle Uri address during installation

Hi,

I’m using the following script to install a Tentacle on a new server using Chocolatey. This works very well with one problem: at the octopus server the tentacle url is set to :. This doens’t work for me, it should be :. Can this be done? Is there a switch statement that I can use?

$arguments = @{}

Let’s assume that the input string is something like this, and we will use a Regular Expression to parse the values

/Port:81 /Edition:LicenseKey /AdditionalTools

Now we can use the $env:chocolateyPackageParameters inside the Chocolatey package

$packageParameters = $env:chocolateyPackageParameters

Write-Host $packageParameters

Default the values

$port = “10933”

Now parse the packageParameters using good old regular expression

if ($packageParameters) {
$match_pattern = “/(?([a-zA-Z]+)):(?(["'])?([a-zA-Z0-9- _\\:\.]+)([”’])?)|/(?([a-zA-Z]+))"
$option_name = ‘option’
$value_name = ‘value’

  if ($packageParameters -match $match_pattern ){
      $results = $packageParameters | Select-String $match_pattern -AllMatches
      $results.matches | % {
        $arguments.Add(
            $_.Groups[$option_name].Value.Trim(),
            $_.Groups[$value_name].Value.Trim())
    }
  }
  else
  {
      Throw "Package Parameters were found but were invalid (REGEX Failure)"
  }

  if ($arguments.ContainsKey("Port")) {
      Write-Host "Port Argument Found"
      $port = $arguments["Port"]
  }

} else {
Write-Debug “No Package Parameters Passed in”
}

$silentArgs = “/S /Port:” + $port

Write-Debug “This would be the Chocolatey Silent Arguments: $silentArgs”

Install-ChocolateyPackage -PackageName 'octopustentacle'
-FileType ‘msi’ -SilentArgs '/quiet'
-Url ‘https://download.octopusdeploy.com/octopus/Octopus.Tentacle.3.4.14.msi-Url64bit 'https://download.octopusdeploy.com/octopus/Octopus.Tentacle.3.4.14-x64.msi'
-Checksum ‘ED95CB194A124C7BD5D67978EDCE722C139A4F80A0B46D6531923B112D032F77’ -ChecksumType 'SHA256'
-Checksum64 ‘7A468F71B18E099BB3CCC81D603CC3225114D67F516D397F8A61EB03DBCEEE55’ `
-ChecksumType64 ‘SHA256’

cd “C:\Program Files\Octopus Deploy\Tentacle”

& .\Tentacle.exe create-instance --instance “Tentacle” --config “C:\Octopus\Tentacle.config” --console
& .\Tentacle.exe new-certificate --instance “Tentacle” --if-blank --console
& .\Tentacle.exe configure --instance “Tentacle” --reset-trust --console
& .\Tentacle.exe configure --instance “Tentacle” --home “C:\Octopus” --app “C:\Octopus\Applications” --port “10933” --console
& .\Tentacle.exe configure --instance “Tentacle” --trust “” --console
netsh advfirewall firewall add rule “name=Octopus Deploy Tentacle” dir=in action=allow protocol=TCP localport=10933
& .\Tentacle.exe register-with --instance “Tentacle” --server “http://xxxxxx.westeurope.cloudapp.azure.com” --apiKey="" --role “web-server” --environment “Test” --comms-style TentaclePassive --console
& .\Tentacle.exe service --instance “Tentacle” --install --start --console

Kind regards,
Erwin

Hi Erwin,

Thanks for reaching out. If I understand correctly, the publicHostName parameter for the Tentacle’s register-with command will let you specify the IP address that the server uses.

Hope that helps and if I can assist further please let me know.

Shannon

I cannot acces that url since I need to log in.

I think I’m looking for a switch parameter to register-with. Something like --TentacleIp “13.0.0.12”

& .\Tentacle.exe register-with --instance “Tentacle” --TentacleIp “13.0.0.12” --server “http://xxxxxx.westeurope.cloudapp.azure.com” --apiKey="" --role “web-server” --environment “Test” --comms-style TentaclePassive --console

In this documentation http://docs.octopusdeploy.com/display/OD/Automating+Tentacle+installation I read about: $tentacle.Endpoint.Uri = “https://YOUR_TENTACLE:10933”. So I’m looking for that equivalent for Tentacle.exe. Something like --TentacleEndpointUri. Does that exist?

Kind regards,
Erwin

I should have read before I posted an answer… Adding --publicHostName to register-with does the trick!

Hi Erwin,

Glad that got it working for you.

Shannon