Auto Configure Tentacle using Powershell

Hi

I am trying to use Ansible to auto configure Octo Tentacle’s on many servers.

I am using a Pwershell script to try and do this…here is the script:
& “C:\Program Files\Octopus Deploy\Tentacle\Tentacle.exe” create-instance --instance “Tentacle” --config “C:\Octopus\Tentacle.config” --console;
& “C:\Program Files\Octopus Deploy\Tentacle\Tentacle.exe” new-certificate --instance “Tentacle” --if-blank --console;
& “C:\Program Files\Octopus Deploy\Tentacle\Tentacle.exe” configure --instance “Tentacle” --reset-trust --console;
& “C:\Program Files\Octopus Deploy\Tentacle\Tentacle.exe” configure --instance “Tentacle” --home “C:\Octopus” --app “C:\Octopus\Applications” --port “10933” --noListen “False” --console;
& “C:\Program Files\Octopus Deploy\Tentacle\Tentacle.exe” configure --instance “Tentacle” --trust “xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx” --console;
& “C:\Program Files\Octopus Deploy\Tentacle\Tentacle.exe” service --instance “Tentacle” --install --start --console;

This fails every time I run the Ansible playbook. Although if I run the above script directly on the server it works perfectly.

If I look at the event viewer of the servers after I run the Powershell script I see several access denied errors:
1 FATAL System.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)

1 FATAL Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
System.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)

I assume this is failing as the Powershell script is not running while being logged into the server?

What is the best way to get this work?

Cheers
Mark

Hi Mark,

Thanks for reaching out.

The Access is denied error makes me think that the Ansible process running this scriptis not being executed by an account with enough permissions to run Tentacle.exe.

I haven’t used Anslble before, but I imagine its possible to configure the “agent” that executes the Powershell script on the target machine to run under another user/service account. Have you tried that already?

Regards,
Dalmiro