Octopus Tentacle automated deploy/msi edit

Hi,

I would like to deploy Octopus Tentacle to multiple machines and fully automate the task.
I can do most of it with 2 exceptions:

  • configure app Not to use proxy
  • run service with domain account

So, I have this powershell script to run after installation which has most of the config except the 2 above:

$serverThumbprint = "thumbprint"
$serverUri = "http://octopus"
$tentacleInstallApiKey = "API-KEY"
$role = "ROLE"
$environment = "ENV"


function Tentacle-Configure([string]$arguments)
{
    Write-Output "Configuring Tentacle with $arguments"

    $pinfo = New-Object System.Diagnostics.ProcessStartInfo
    $pinfo.FileName = "C:\Program Files\Octopus Deploy\Tentacle\Tentacle.exe"
    $pinfo.RedirectStandardError = $true
    $pinfo.RedirectStandardOutput = $true
    $pinfo.CreateNoWindow = $true; 
    $pinfo.UseShellExecute = $false;
    $pinfo.UseShellExecute = $false
    $pinfo.Arguments = $arguments
    $p = New-Object System.Diagnostics.Process
    $p.StartInfo = $pinfo
    $p.Start() | Out-Null
    $p.WaitForExit()
    $stdout = $p.StandardOutput.ReadToEnd()
    $stderr = $p.StandardError.ReadToEnd()
    
    Write-Host $stdout
    Write-Host $stderr
    
    if ($p.ExitCode -ne 0) {
        Write-Host "Exit code: " + $p.ExitCode
        throw "Configuration failed"
    }
}


Write-Output "Configuring Tentacle"
Tentacle-Configure "create-instance --instance `"Tentacle`" --config `"C:\Octopus\Tentacle.config`" --console"
Tentacle-Configure "new-certificate --instance `"Tentacle`" --if-blank --console"
Tentacle-Configure "configure --instance `"Tentacle`" --reset-trust --console"
Tentacle-Configure "configure --instance `"Tentacle`" --home `"C:\Octopus`" --app `"D:\Octopus\Applications`" --port `"10933`" --console"
Tentacle-Configure "configure --instance `"Tentacle`" --trust `"$serverThumbprint`" --console"
netsh advfirewall firewall add rule "name=Octopus Deploy Tentacle" dir=in action=allow protocol=TCP localport=10933
Tentacle-Configure "register-with --instance `"Tentacle`" --server `"$serverUri`" --apiKey=`"$tentacleInstallApiKey`" --role `"$role`" --environment `"$environment`" --comms-style TentaclePassive --console"
Tentacle-Configure "service --instance `"Tentacle`" --install --start --console"

Write-Output "Config for Tentacle Completed"

Remove-Item $PSCommandPath

Is it possible to add something in this script to configure not to use proxy and also add the service to run as a domain account?

or

Is it possible to modify the .msi with Orca and do these changes?

I’m happy with either option but it would be nice to see an option with .msi edit proprieties.

I found out about the proxy config :

Tentacle-Configure “proxy --instance "Tentacle” --proxyEnable "False" --proxyUsername "" --proxyPassword "" --proxyHost "" --proxyPort ""`

still working on run as user task…

Hi,

Yes! There is a username and password option for the service command.

 Tentacle-Configure "service --instance `"Tentacle`" --username "ServiceUser" --password "ServicePassword" --install --start --console"

Both --username and --password only apply when using the --install flag.

Hope that helps.

Thank You Cameron.

I have a script and a procedure to do a full unattended installation and configuration of Octopus Tentacle.

It might help others…so, this is what I do:

Install application:

msiexec /i Octopus.Tentacle.msi /quiet RUNMANAGERONEXIT=no

Add Domain User as admin to the machine:

net localgroup administrators domain\YourUsername /add

Configure Octopus Tentacle:

$serverThumbprint = “[YOUR-SERVER-THUMBPRINT]”
$serverUri = “[YOUR-SERVER-URI]”
$tentacleInstallApiKey = “[YOUR-TENTACLE-INSTALL-APIKEY]”
$role = “[YOUR-TENTACLE-ROLE]”
$environment = “[YOUR-TARGET-ENVIRONMENT]”

function Tentacle-Configure([string]$arguments)
{
Write-Output “Configuring Tentacle with $arguments”

$pinfo = New-Object System.Diagnostics.ProcessStartInfo
$pinfo.FileName = "C:\Program Files\Octopus Deploy\Tentacle\Tentacle.exe"
$pinfo.RedirectStandardError = $true
$pinfo.RedirectStandardOutput = $true
$pinfo.CreateNoWindow = $true; 
$pinfo.UseShellExecute = $false;
$pinfo.UseShellExecute = $false
$pinfo.Arguments = $arguments
$p = New-Object System.Diagnostics.Process
$p.StartInfo = $pinfo
$p.Start() | Out-Null
$p.WaitForExit()
$stdout = $p.StandardOutput.ReadToEnd()
$stderr = $p.StandardError.ReadToEnd()

Write-Host $stdout
Write-Host $stderr

if ($p.ExitCode -ne 0) {
    Write-Host "Exit code: " + $p.ExitCode
    throw "Configuration failed"
}

}

Write-Output “Configuring Tentacle”
Tentacle-Configure “create-instance --instance "Tentacle” --config "C:\Octopus\Tentacle.config" --console"
Tentacle-Configure “new-certificate --instance "Tentacle” --if-blank --console"
Tentacle-Configure “configure --instance "Tentacle” --reset-trust --console"
Tentacle-Configure “configure --instance "Tentacle” --home "C:\Octopus" --app "D:\Octopus\Applications" --port "10933" --console"
Tentacle-Configure “proxy --instance "Tentacle” --proxyEnable "False" --proxyUsername "" --proxyPassword "" --proxyHost "" --proxyPort "" "
Tentacle-Configure “configure --instance "Tentacle” --trust "$serverThumbprint" --console"
netsh advfirewall firewall add rule “name=Octopus Deploy Tentacle” dir=in action=allow protocol=TCP localport=10933
Tentacle-Configure “register-with --instance "Tentacle” --server "$serverUri" --apiKey="$tentacleInstallApiKey" --role "$role" --environment "$environment" --comms-style TentaclePassive --console"
Tentacle-Configure “service --instance "Tentacle” --username "YOUR Username" --password "YOUR Password" --install --start --console"
Write-Output “Installation Tentacle Completed”
Remove-Item $PSCommandPath