Atomating tentacle registration

after installing temtacle on a machine and running the powershell script copied from https://github.com/OctopusDeploy/OctopusDeploy-Api/blob/master/Octopus.Client/PowerShell/Machines/RegisterPollingTentacle.ps1#L8

I end up with tentacle nicely registered on octopus server, but after first health check tentacle is unreachable, going onto the machine, and checking services, there is no tentacle service

Hello,

Thanks for getting in touch. Tentacle connection issues can be quite tricky to troubleshoot, as it’s a complicated area where there’s a lot of moving parts that will impact the communication.

The fastest way to hopefully resolve your issue will be to go through our tentacle troubleshooting guide, it has lots of detailed sections for all the possible scenarios and will help us pinpoint your issue https://octopus.com/docs/how-to/troubleshoot-polling-tentacles

Let us know if any part of it is unclear or you get stuck.

Regards,
Nick

Thanks.

We can close this feed. I went with composing installer bats from an inventory file, pushing them to target machines and scheduling a task to execute

Hi Mert.Oral

Could you please give me a example of your script for pushing tentacle files to target machine and scheduling a task to execute.

Right now i have to install Certificate manualy on target machines, to get it all to work :frowning:

Regards,
Jan

function InstallService
{
param($ip,$cred,$machineName,$environment,$roles)
$invocation = (Get-Variable MyInvocation).Value

#$msiPath = GetInstallerFile
$batPath = GetBatFile

$remoteSession = New-PSSession -ComputerName $ip  -Credential $cred

#Copy-Item -ToSession $remoteSession -Path $msiPath -Destination "C:\" -force
Copy-Item -ToSession $remoteSession -Path $batPath -Destination "C:\" -force

Invoke-Command -Session $remoteSession -ScriptBlock{
    param($machineName,$environment,$roles)

    $taskName = "tentacle"
    $taskExists = Get-ScheduledTask | Where-Object {$_.TaskName -like $taskName }
    if(-Not ($taskExists -eq $null))
    {
        Unregister-ScheduledTask -TaskName $taskName -Confirm:$false
    }




    Write-Host "Starting Tentacle install script:"
    $a = New-ScheduledTaskAction -Execute " C:\tentacleInstaller.bat"
    Register-ScheduledTask -TaskName tentacle  -RunLevel Highest -User "domain\user" -Password "password" -Action $a | Start-ScheduledTask
    do
    {
        Start-Sleep -Seconds 15
        $task=Get-ScheduledTask -TaskName tentacle
    }while($task.State -eq 4)

}-ArgumentList $machineName,$environment,$roles

}

Ignore roles and environment parameter… This function assumes you have a bat file on local machine that has environment and roles

(i.e go through tentacle setup wizard, copy cmd line at the end, and have your GetBatFile function make necessary changes to roles, environment and machine name)

Hi,

We do something similar in that we run a script from the octopus server which cycles through a csv to create a new thumbprint and connect each server to Octopus with their appropriate roles. This does mean the tentacle has to already be installed
on the server however this is done as part of the initial build process for us.

This script has been embedded into our environment creation scripts to ensure we always have the tentacles connected throughout the life cycle.

If your interested I can upload a copy of it to here