On my (winrm) target host, I am able to run the following:

PS C:\Users\agenerette> c:/Python27/python.exe 
c:/xx/run/yy/tests/confluence_api_test.py


When I try to incorporate that into a playbook, however, I get a great 
block of mostly encoded error output that I'm not able to make sense of.  
I've attached a couple of screen-shots to give a more complete picture of 
what I'm seeing, but here's an excerpt:

PLAY [873320-wrk04-ia] 
*********************************************************

TASK [Do a test run of Sharefiles and Confluence API scripts...] 
***************
Traceback (most recent call last):
  File 
"/usr/lib/python2.6/site-packages/ansible/plugins/connection/winrm.py", 
line 274, in exec_command
    result = self._winrm_exec(cmd_parts[0], cmd_parts[1:], from_exec=True)
  File 
"/usr/lib/python2.6/site-packages/ansible/plugins/connection/winrm.py", 
line 219, in _winrm_exec
    response = Response(self.protocol.get_command_output(self.shell_id, 
command_id))
  File 
"/home/agenerette/.local/lib/python2.6/site-packages/winrm/protocol.py", 
line 398, in get_command_output
    self._raw_get_command_output(shell_id, command_id)
  File 
"/home/agenerette/.local/lib/python2.6/site-packages/winrm/protocol.py", 
line 417, in _raw_get_command_output
    res = self.send_message(xmltodict.unparse(req))
  File 
"/home/agenerette/.local/lib/python2.6/site-packages/winrm/protocol.py", 
line 244, in send_message
    fault = root.find('soapenv:Body/soapenv:Fault', xmlns)
TypeError: find() takes exactly 2 arguments (3 given)
failed: [873320-wrk04-ia] (item=c:/t3/run/ae/tests/sharefile_api_test.py) 
=> {"item": "c:/t3/run/ae/tests/sharefile_api_test.py", "msg": "failed to 
exec cmd PowerShell -NoProfile -NonInteractive -ExecutionPolicy 
Unrestricted -EncodedCommand


And here's a copy of the playbook:

---
- hosts: "{{ targets }}"
  user: "{{ admin }}"
  gather_facts: yes

  vars:
    python_exec: c:/Python27/python.exe
    working_dir: c:/xx/run/yy

    sharefile_script: c:/xx/run/yy/tests/sharefile_api_test.py
    confl_script: c:/xx/run/yy/tests/confluence_api_test.py

  tasks:
    - name: Do a test run of Sharefiles and Confluence API scripts...
      win_shell: "'{{ python_exec }} {{ item }}'"
#     win_shell: "Get-Item Env:ldap_user"
      with_items:
        - "{{ sharefile_script }}"
        - "{{ confl_script }}"
      environment:
        LDAP_USER: "{{ my_ldap_user }}"
        LDAP_REG_CODE: "null"
        LDAP_PASS: "{{ my_ldap_pass }}"
        GDOC_PASS: "{{ my_gdoc_pass }}"
        SHARE_USER: "{{ my_sharefiles_user }}"
        SHARE_PASS: "{{ my_sharefiles_pass }}"
        WIKI_USERNAME: "{{ my_ldap_user }}"
        WIKI_PASSWORD: "{{ my_ldap_pass }}"
      ignore_errors: yes
      register: result
    - debug: var=result




<https://lh3.googleusercontent.com/-AYwGu7dFiP4/Wvr6XppgvfI/AAAAAAAABP8/DMk7nhc77WgQ0rbKnB6VkarHS3XEiwfogCLcBGAs/s1600/Screen%2BShot%2B2018-05-15%2Bat%2B11.16.41%2BAM.png>

<https://lh3.googleusercontent.com/-SemZOrsECIY/Wvr6bf4frNI/AAAAAAAABQA/3MerSpR9958Oml0bHyluR3UGZAdzP9j2gCLcBGAs/s1600/Screen%2BShot%2B2018-05-15%2Bat%2B11.17.12%2BAM.png>

-- 
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/a6f3c3e2-e364-4051-b857-110257fbdd36%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to