A few comments on this:
The best way to troubleshoot stuff like this is not only to try and run the 
script locally, but also run it using a psremoting session from another 
machine. That will more closely mimic what Ansible is doing.

If there is a problem with the script quitting too soon you should be able 
to verify this by simply adding a start-sleep to the end of your script? If 
that solves it the root cause of the problem won't have anything to do with 
Ansible, but with with Octopus.

As far as Administrators go, a default setup of windows will only allow 
members of the administrators group to access the server thru WinRM, and 
UAC is never invoked inside a WinRM session. So basically, you have as much 
permission as you possibly can on the machine.



On Wednesday, February 24, 2016 at 5:10:33 PM UTC+1, Mark Matthews wrote:
>
> Hi Jon
>
> I had a look at the event viewer and saw that that it is getting an access 
> is denied error (this happens for all commands in the powershell script):
>
> 2016-02-24 15:53:12.2675      1 FATAL  System.UnauthorizedAccessException: 
> Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
>
> I am running the playbook with the server admin account, so not sure why 
> this is failing?
>
> Is there a way of forcing the script to run with a specific administrator 
> account so that it succeeds?
>
> Cheers
> Mark
>
>
> On Wednesday, February 24, 2016 at 2:04:42 PM UTC, Mark Matthews wrote:
>>
>> Hi
>>
>> I hae a playbook that runs a powershell script to configure an Octopus 
>> Deploy Tentacle.
>>
>> If I run this powershell script on the server it works perfectly. If I 
>> run playbook with the powershell script it fails on the server.
>>
>> What could possibly be causing this? Permissions? Timing out?
>>
>>
>> Playbook:
>> ---
>> - name: Configure Octopus Deploy Tentecle
>>   hosts: all
>>   tasks:
>>     - name: Configure Octopus Deploy Tentecle
>>       script: files/octo_autoconfig.ps1
>>
>>
>> Powershell 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 "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" 
>> --console;
>> & "C:\Program Files\Octopus Deploy\Tentacle\Tentacle.exe" service 
>> --instance "Tentacle" --install --start --console;
>>
>> Error I get when I try open Octopus Tenticle after running the playbook 
>> to config Octopus:
>>
>> System.NullReferenceException: Object reference not set to an instance of 
>> an object.
>>    at 
>> Octopus.Tools.TentacleConfiguration.TentacleManager.TentacleManagerModel.Reload(ApplicationInstanceRecord
>>  
>> applicationInstance) in 
>> y:\work\refs\heads\master\source\Octopus.Tools\TentacleConfiguration\TentacleManager\TentacleManagerModel.cs:line
>>  
>> 131
>>    at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate 
>> callback, Object args, Int32 numArgs)
>>    at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object 
>> source, Delegate callback, Object args, Int32 numArgs, Delegate 
>> catchHandler)
>>
>>
>> Note that if I run the Powershell script directly on the server it works 
>> perfectly and configures the tentacle. If I then remove the tentacle and 
>> then run the playbook it works. So its as if the tenticle needs to be 
>> configured first directly on the server before an Ansible playbook can 
>> work. Which kind of defeats the point.
>>
>> Im thinking that Ansible is deleting the powershell script from the temp 
>> directly it saves it to before the script is finishing running? Is that 
>> possible?
>> Is there a way of telling Ansible to wait until everything is completed 
>> in the script before it moves on or removes the temp file?
>>
>>
>> Any help would be appreciated.
>>
>>
>> Cheers
>> Mark
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/031a3e98-ca6b-4d56-8fb5-a96da950c9c5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to