Alex,
What about the solution here:
http://help.octopusdeploy.com/discussions/questions/5421-remote-tentacle-registration
It seems I have basically the same issue … I have the ability to run whatever scripts I want remotely on all servers in question, I just can’t call over http….so I thought I could do something like the following run from the octopus server?..
#run from the octopus server
$remotetentacleserver = “server_I_want_to_install_the_tentacle_on”
Invoke-Command -ComputerName $remotetentacleserver -ScriptBlock {
#install msi
$msifile= “C:\Temp\Octopus.Tentacle.3.4.10-x64.msi”
$arguments= ’ /qn '
Start-Process -file $msifile -arg $arguments -passthru | wait-process
& “C:\Program Files\Octopus Deploy\Tentacle\Tentacle.exe” create-instance --instance “Dave” --config “C:\Octopus\Dave\Tentacle-Dave.config”
& “C:\Program Files\Octopus Deploy\Tentacle\Tentacle.exe” new-certificate --instance “Dave” --if-blank
& “C:\Program Files\Octopus Deploy\Tentacle\Tentacle.exe” configure --instance “Dave” --home “C:\Octopus” --app “C:\Octopus\Applications\Dave” --port “10933”
& “C:\Program Files\Octopus Deploy\Tentacle\Tentacle.exe” configure --instance “Tentacle” --trust “B0D392716E8FB8830494BB61F6F341C31EFC6505” --console
& “C:\Program Files\Octopus Deploy\Tentacle\Tentacle.exe” service --instance “Dave” --install --start
$TentacleThumb = & “C:\Program Files\Octopus Deploy\Tentacle\Tentacle.exe” Show-thumbprint
}
Step 2
Add-Type -Path ‘C:\Program Files\Octopus Deploy\Tentacle\Octopus.Client.dll’
$apikey = ‘API-XXXXXXXX’ # Get this from your profile
$octopusURI = ‘http://XXXXXXXX’ # Your Octopus Server address
$tentacleThumbprint = “$TentacleThumb”
$environmentId = “XXXX Environment” # Get this from /api/environments
$role = “web-server” # The role of the machine
$machineName = “Dave” # The name of the machine
$endpoint = New-Object Octopus.Client.OctopusServerEndpoint $octopusURI,$apikey
$repository = New-Object Octopus.Client.OctopusRepository $endpoint
$tentacleEndpoint = New-Object Octopus.Client.Model.Endpoints.PollingTentacleEndpointResource
$tentacleEndpoint.Thumbprint = $tentacleThumbprint
$tentacleEndpoint.Uri = “poll://” + ((char[] | sort {get-random})[0…20] -Join ‘’) + “/”
$tentacle = New-Object Octopus.Client.Model.MachineResource
$tentacle.Endpoint = $tentacleEndpoint
$tentacle.EnvironmentIds.Add($environmentId)
$tentacle.Roles.Add($role)
$tentacle.Name = $machineName
$repository.Machines.Create($tentacle)
Write-Host “Add this value to the ‘Tentacle.Communication.TrustedOctopusServers’ key in Tentacle-${machineName}.config”
$server = [ordered]@{
“Thumbprint” = “”; # Your Octopus Server Thumbprint
"CommunicationStyle" = 2;
“Address” = “http://tfsbuild:9999”; # Your Octopus Server URL and Communications port (10943 by default)
“Squid” = “”;
“SubscriptionId” = $tentacleEndpoint.Uri;
}
$server | ConvertTo-Json -Compress
#Step 3:- Open the Tentacle configuration file of your new Tentacle (specified when you registered the Tentacle in step 1) - Add the JSON output by step 2 above to the Tentacle.Communication.TrustedOctopusServers (within the []) - Save the config file - Restart the Tentacle service
I haven’t powershelled this out but I can do this no worries I think.
I just have one issue…with this line:
$tentacleEndpoint.Uri = “poll://” + ((char[] | sort {get-random})[0…20] -Join ‘’) + “/”
This comes back with an error….but what value is this trying to find? Possibly I could find it from within the server itself?
What do you think?
Dave