vagrant@ansible-tower ~]$ sudo su - awx
Last login: Sat Apr 1 23:12:18 JST 2017 on pts/1
Welcome to Ansible Tower!
Log into the web interface here: etc...
-bash-4.2$ cat test.py
import sys
from winrm.protocol import Protocol
HYPERV_SERVER = 'https://louis.home.cartewright.com:5986/wsman'
class RM():
def __init__(self):
self.win_connect = Protocol(endpoint=HYPERV_SERVER, transport='kerberos', server_cert_validation='ignore')
def test(self):
shell_id = self.win_connect.open_shell()
cmd = "dir"
command_id = self.win_connect.run_command(shell_id, cmd)
output,error_value,exit_status = self.win_connect.get_command_output(shell_id, command_id)
self.win_connect.cleanup_command(shell_id, command_id)
self.win_connect.close_shell(shell_id)
print output
def main():
rm = RM()
rm.test()
if __name__ == '__main__':
main()
sys.exit()
-bash-4.2$ python test.py
Volume in drive C is SAMSUNG 512GB SSD
Volume Serial Number is 2C8F-7BFA
Directory of C:\Users\ansible
03/31/2017 11:04 AM <DIR> .
03/31/2017 11:04 AM <DIR> ..
07/16/2016 06:47 AM <DIR> Desktop
03/31/2017 11:04 AM <DIR> Documents
07/16/2016 06:47 AM <DIR> Downloads
07/16/2016 06:47 AM <DIR> Favorites
07/16/2016 06:47 AM <DIR> Links
07/16/2016 06:47 AM <DIR> Music
07/16/2016 06:47 AM <DIR> Pictures
07/16/2016 06:47 AM <DIR> Saved Games
07/16/2016 06:47 AM <DIR> Videos
0 File(s) 0 bytes
11 Dir(s) 291,787,771,904 bytes free
-bash-4.2$
-bash-4.2$ cat /etc/ansible/group_vars/windows.yml
ansible_connection: winrm
ansible_user: ans...@HOME.CARTEWRIGHT.COM
ansible_password: R1pflash
ansible_winrm_server_cert_validation: ignore
-bash-4.2$
-bash-4.2$ ansible windows -m win_ping -v
Using /etc/ansible/ansible.cfg as config file
louis.home.cartewright.com | SUCCESS => {
"changed": false,
"ping": "pong"
}
---
- name: WinPing
hosts: all
tasks:
- name: knit
local_action: command echo "xxxxxxx" | kinit -l 7d -r 7d -pf ansible@HOME.CARTEWRIGHT.COM
- name: ping
win_ping:
--
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/-7e0do1u8dk/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/5ca67b34-4b01-4c10-bb3a-5956d24c24ad%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/9df03222-6b17-40dc-980d-eb62311ad4e4%40googlegroups.com.