Thanks Jordan for your prompt response. Issue was with argument which i was passing in win_command. win_command: 'C:\temp\setup.exe /SP /VERYSILENT /DIR=C:/temp* /LOG=C:/temp/Install.log'*
Here *temp *directory was not there to create log file but after creating temp directory, i'm able to install setup.exe file successfully. Also as you mentioned, become method is not require to run 'RunAs Administrator'. I'm able to install setup.exe without become method. Regards, Venkat On Wednesday, 14 November 2018 01:53:29 UTC+5:30, Jordan Borean wrote: > > Become isn't necessarily used to 'run as administrator' in Windows but > rather to change the logon from a network to interactive logon with > credentials to use for delegation. Normally a WinRM process is run with the > full Administrative rights of an account and you can verify that by running > > - name: getlogon details for current user > win_whoami: > > This will return a whole bunch of information but if the label key > contains a 'High Mandatory Label' you know you are running as an admin. In > older versions of Ansible, a become task may not have admin rights and > since 2.5 it is done as a best effort attempt. I would do the below to > verify you are least get the High Mandatory Label returned when using > become to verify that process is run with admin rights as well. > > - name: test whoami with become > win_whoami: > become: yes > become_method: runas > become_user: Administrator > > As for why the process is still running it could be a few different things; > > - Become runs the task in a pseudo interactive logon so it may be > prompting the user for something causing it to hang > - The args you are using aren't the correct silent args for the process > - Some else? > > What I would try > > - Run the same command locally and see if it works or not > - Check the log file when being installed with Ansible to see if > there's anything in there that might indicate what it's waiting for > - Try running the task with async and become, this changes a few > things with how the console is spawned and killed so may work for you > - Use procexp to see what processes are still running, whether the > main powershell exe that executes the module is still running, if > setup.exe > is still running and so on. > > > Thanks > > Jordan > > -- 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/9b5e8560-97c9-484b-9eb7-747570ead598%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
