You will need to (temporarily) turn of UAC prompting for Adminstrator users 
then.

You can change this using win_regedit

HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\System
ConsentPromptBehaviorAdmin

needs to 0 for it to be off, and 2 to be back on again.

Hope this helps,

Jon

On Tuesday, 16 February 2016 13:24:08 UTC, ishan jain wrote:
>
> Hi Jon,
>
> Indeed i am using the admin account to connect to the windows machine via 
> ansible. Even when you are logged into the windows machine directly with 
> the admin account, it would require you to again elevate the privileges to 
> start as admin, so it is obvious we need additional steps to connect via 
> ansible other than using the admin account.
> On Friday, 12 February 2016 20:42:42 UTC+5:30, J Hawkesworth wrote:
>>
>> You will need to connect as a user with admin level privileges.
>> You can probably use win_copy to push the nssm.exe on to your machine 
>> first.
>> If I recall it is a single standalone executable with no external 
>> dependencies (except possibly .net)
>> Jon
>>
>> On Friday, 12 February 2016 09:04:26 UTC, ishan jain wrote:
>>>
>>> Thanks Joe,
>>>
>>> I tried using the raw module but the problem i am facing is that NSSM 
>>> requires admin level privileges to start/stop services. How can i enable 
>>> 'Run as admin' level while passing a command in NSSM ? My windows machine 
>>> do not have a pre installed NSSM and thus i cannot create a service with 
>>> raw and then start it with the module later on.
>>>
>>> On Thursday, 11 February 2016 20:46:25 UTC+5:30, Joe Levis wrote:
>>>>
>>>> Ishan,
>>>>
>>>> The raw module works pretty much the same on Windows as it does on 
>>>> Linux - anything you can run on the command line can be run using the raw 
>>>> module. So, if you are wanting to use this nssm.exe rather than actually 
>>>> installing nssm, you would simply specify the path to the executable and 
>>>> pass whatever arguments it enables.
>>>>
>>>> I haven't found a way to specify the AppDirectory upon creation of the 
>>>> service, so what I do is run the raw module to set that *after* the 
>>>> service has been created. For you, this might look something like this:
>>>>
>>>> raw: C:\path\to\nssm.exe set [ServiceName] AppDirectory 
>>>> C:\path\to\appdirectory
>>>>
>>>>
>>>> Hope this helps.
>>>>
>>>>
>>>> -Joe
>>>>
>>>> On Thursday, February 11, 2016 at 6:47:42 AM UTC-8, ishan jain wrote:
>>>>>
>>>>> Hi,
>>>>>
>>>>> I am trying to create some services on my windows machines with the 
>>>>> help of NSSM and would like to automate the process with Ansible. NSSM 
>>>>> module for ansible requires NSSM to be installed on the windows machine 
>>>>> but 
>>>>> i cannot do that as internet is disabled on my windows machine. I want to 
>>>>> use the nssm.exe that i have copied on the remote server.
>>>>>
>>>>> How can i tell ansible to use those copied executables to run NSSM ? I 
>>>>> really need to specify the ApplicationDir, so i guess the ansible module 
>>>>> is 
>>>>> not going to be useful for me.
>>>>>
>>>>> I think this problem will be solved via the raw module but honestly i 
>>>>> do not understand it much. Maybe because there is no proper documentation 
>>>>> of raw module for windows.
>>>>>
>>>>

-- 
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/1a30067a-60e1-4008-a88c-6c103e5b86de%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to