- name: copy chmod batch file over
win_copy:
src: /ansible/batch/chmod.bat
dest: C:\TEMP\chmod.bat
- name: copy chmod sh file over
win_copy:
src: /ansible/batch/chmod.sh
dest: C:\TEMP\chmod.sh
- name: Run Batch File
win_command: C:\TEMP\chmod.bat
Contents of bat:
C:\cygwin\bin\mintty.exe C:\TEMP\chmod.sh
Contents of sh:
chmod 660 /etc/rsyncd.secrets
ansible -i inventory.ini hosts -m win_command -a "whoami /all"
(ansible-py36) jborean:~/dev/module-tester$ ansible -i inventory.ini '2016' -m win_command -a "whoami /all"
SERVER2016.domain.local | SUCCESS | rc=0 >>
USER INFORMATION
----------------
User Name SID
===================== ==============================================
domain\vagrant-domain S-1-5-21-3242954042-3778974373-1659123385-1104
GROUP INFORMATION
-----------------
Group Name Type SID Attributes
============================================= ================ ============================================= ===============================================================
Everyone Well-known group S-1-1-0 Mandatory group, Enabled by default, Enabled group
BUILTIN\Users Alias S-1-5-32-545 Mandatory group, Enabled by default, Enabled group
BUILTIN\Administrators Alias S-1-5-32-544 Mandatory group, Enabled by default, Enabled group, Group owner
NT AUTHORITY\NETWORK Well-known group S-1-5-2 Mandatory group, Enabled by default, Enabled group
NT AUTHORITY\Authenticated Users Well-known group S-1-5-11 Mandatory group, Enabled by default, Enabled group
NT AUTHORITY\This Organization Well-known group S-1-5-15 Mandatory group, Enabled by default, Enabled group
DOMAIN\Domain Admins Group S-1-5-21-3242954042-3778974373-1659123385-512 Mandatory group, Enabled by default, Enabled group
DOMAIN\Denied RODC Password Replication Group Alias S-1-5-21-3242954042-3778974373-1659123385-572 Mandatory group, Enabled by default, Enabled group, Local Group
NT AUTHORITY\NTLM Authentication Well-known group S-1-5-64-10 Mandatory group, Enabled by default, Enabled group
Mandatory Label\High Mandatory Level Label S-1-16-12288
PRIVILEGES INFORMATION
----------------------
Privilege Name Description State
========================================= ================================================================== =======
SeIncreaseQuotaPrivilege Adjust memory quotas for a process Enabled
SeSecurityPrivilege Manage auditing and security log Enabled
SeTakeOwnershipPrivilege Take ownership of files or other objects Enabled
SeLoadDriverPrivilege Load and unload device drivers Enabled
SeSystemProfilePrivilege Profile system performance Enabled
SeSystemtimePrivilege Change the system time Enabled
SeProfileSingleProcessPrivilege Profile single process Enabled
SeIncreaseBasePriorityPrivilege Increase scheduling priority Enabled
SeCreatePagefilePrivilege Create a pagefile Enabled
SeBackupPrivilege Back up files and directories Enabled
SeRestorePrivilege Restore files and directories Enabled
SeShutdownPrivilege Shut down the system Enabled
SeDebugPrivilege Debug programs Enabled
SeSystemEnvironmentPrivilege Modify firmware environment values Enabled
SeChangeNotifyPrivilege Bypass traverse checking Enabled
SeRemoteShutdownPrivilege Force shutdown from a remote system Enabled
SeUndockPrivilege Remove computer from docking station Enabled
SeManageVolumePrivilege Perform volume maintenance tasks Enabled
SeImpersonatePrivilege Impersonate a client after authentication Enabled
SeCreateGlobalPrivilege Create global objects Enabled
SeIncreaseWorkingSetPrivilege Increase a process working set Enabled
SeTimeZonePrivilege Change the time zone Enabled
SeCreateSymbolicLinkPrivilege Create symbolic links Enabled
SeDelegateSessionUserImpersonatePrivilege Obtain an impersonation token for another user in the same session Enabled
USER CLAIMS INFORMATION
-----------------------
User claims unknown.
Kerberos support for Dynamic Access Control on this device has been disabled.Mandatory Label\High Mandatory Level means an administrator token while medium means a normal token.- win_command: C:\cygwin\bin\mintty.exe C:\temp\chmod.sh
become: yes
become_method: runas
become_user: SYSTEM
# or this if it needs to run under the same user
- win_command: C:\cygwin\bin\mintty.exe C:\temp\chmod.sh
become: yes
become_method: runas
vars:
ansible_become_user: '{{ansible_user}}'
ansible_become_pass: '{{ansible_password}}'- win_chocolatey:
name: psexec
state: present
- win_psexec:
command: C:\cygwin\bin\mintty.exe C:\temp\chmod.sh
interactive: yes
system: yeswin_command: 'cmd.exe /c "start C:\cygwin\bin\bash -li /cygdrive/c/TEMP/chmod.sh"'
become: yes
become_method: runas
become_user: SYSTEM
--
You received this message because you are subscribed to a topic in the Google Groups "Ansible Project" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ansible-project/7inLJoctNLk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ansible-project+unsubscribe@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/d7b0e42a-01b1-45a0-be62-b8116bfa2d96%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.