Calling tentacle.exe with win_shell in Ansible Role

Hi,

I’m creating an Ansible galaxy role to install and register an Octopus Deploy Tentacle on a Windows server.

The steps downloading and installing the Octopus Tentacle work fine.

The problem I’m having is configuring the installed Tentacle using Tentacle.exe

Here is the first line of the c:\Temp\RegisterTentacle.bat file:

 "C:\Program Files\Octopus Deploy\Tentacle\Tentacle.exe" create-instance --instance "Tentacle" --config "C:\Octopus\Tentacle.config"

And this is the Ansible playbook code calling the bat file:

- win_shell: RegisterTentacle.bat >> Log.txt
  args:
    executable: cmd
    chdir: c:\Temp

When the playbook is run the following error is output in Log.txt

Cannot start service from the command line or a debugger.  
A Windows Service must first be installed (using installutil.exe) and 
then started with the ServerExplorer, Windows Services Administrative tool 
or the NET START command.

The bat file runs fine from cmd.exe on the server itself, and I have tried using powershell instead of a bat file to no avail.

ps… this query is on Stack Overflow but I didn’t get any takers on there ->
https://stackoverflow.com/questions/46157796/calling-exe-with-win-shell-in-ansible-role

Hi Jeremy,

Thanks for getting in touch! Sorry for the delay in getting back to you on this one.

To work around this issue you you will need to also install and start the Tentacle service before you create the instance. This is very straightforward, just add the following command directly before your existing Tentacle command:

"C:\Program Files\Octopus Deploy\Tentacle\tentacle.exe service --install --start"

I hope that helps, please let me know if there is anything else we can do to assist,

Regards,
Alex

Alex,

Brilliant, thanks will give it a whirl. If I get it working I’ll commit the Ansible role to the Galaxy repo so everyone can use it.

Regards,

Jeremy Nevill
jeremy@nevill.netmailto:jeremy@nevill.net
http://www.nevill.net
07957 467 060

On 21 Sep 2017, at 07:23, Alex Rolley <tender2+dc6b328026@tenderapp.commailto:tender2+dc6b328026@tenderapp.com> wrote:

Hi Jeremy,

That would be great, thanks for the update!

Good luck and happy deploying,

Regards,

Alex