Error with win_ping playbook

Hi,

I meet the next pb when I run the module win_ping with playbook.

EXEC (via pipeline wrapper)
The full traceback is:
Au caract?re Ligne:4 : 3^M
+ & "^@^@^@C^@^@^@:^@^@^@\^@^@^@U^@^@^@s^@^@^@e^@^@^@r^@^@^@s^@^@^@\^@^@^@F^@^@^@C^@^@^@A^@^@^@P^@^@^@G^@^@^@2^@^@^@4^@^@^@\^@^@^@A^@^@^@p^@ ...^M
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I do not have this problem when I run it from the command line.

EXEC (via pipeline wrapper)
xxxxxxxxxxx | SUCCESS => {
    "changed": false,
    "ping": "pong"
}
META: ran handlers
META: ran handlers

For information, I use :
ansible_port: 5986
ansible_connection: winrm
ansible_winrm_transport: kerberos
ansible_winrm_server_cert_validation: ignore

Can you help me please ?

Sounds like a playbook encoding issue.

  • hosts: “{{ app }}.{{ envt }}.winping”
    gather_facts: no
    tasks:
  • name: Test win_ping
    win_ping:

Sorry that’s my fault, the error is actually from the exec side and not a yaml parsing issue. Are you able to share the following;

* The full output when running with -vvv for both runs
* Run “ansible-config dump --only-changed"
* Are there any environment variables you have that relates to Ansible?

Thanks

Jordan

ansible -m win_ping windows -vvv

/usr/lib64/python2.6/site-packages/cryptography-2.3.1-py2.6-linux-x86_64.egg/cryptography/hazmat/primitives/constant_time.py:26: CryptographyDeprecationWarning: Support for your Python version is deprecated. The next version of cryptography will remove support. Please upgrade to a 2.7.x release that supports hmac.compare_digest as soon as possible.
utils.DeprecatedIn23,
ansible 2.4.2.0
config file = /etc/ansible/ansible.cfg
configured module search path = [u’/home/ldap/.ansible/plugins/modules’, u’/usr/share/ansible/plugins/modules’]
ansible python module location = /usr/lib/python2.6/site-packages/ansible
executable location = /usr/bin/ansible
python version = 2.6.6 (r266:84292, Aug 9 2016, 06:11:56) [GCC 4.4.7 20120313 (Red Hat 4.4.7-17)]
Using /etc/ansible/ansible.cfg as config file
Parsed /etc/ansible/hosts inventory source with ini plugin
META: ran handlers
Using module file /usr/lib/python2.6/site-packages/ansible/modules/windows/win_ping.ps1
ESTABLISH WINRM CONNECTION FOR USER: None on PORT 5986 TO xxxxxxxx
/usr/lib/python2.6/site-packages/pywinrm-0.3.0-py2.6.egg/winrm/transport.py:299: UserWarning: Function does not contain optional arg send_cbt, check installed version with pip list
EXEC (via pipeline wrapper)
xxxxxxxx | SUCCESS => {
“changed”: false,
“ping”: “pong”
}
META: ran handlers
META: ran handlers

Fantastic that let’s me know what the issue is, you are coming across this https://github.com/ansible/ansible/pull/45942. Effectively running Python 2.6 with ANSIBLE_KEEP_REMOTE_FILES is causing the issue. While the pull request I linked you solves the issue, you shouldn’t be running ANSIBLE_KEEP_REMOTE_FILES at all. This mode is only meant to be used for debugging purposes and effectively means all the temp files and modules are not deleted once run which is bad and a lot slower than the default pipeling process.

I would guess you have an ansible.cfg that is being picked up when running your playbook that has ‘keep_remote_files’ set https://docs.ansible.com/ansible/latest/reference_appendices/config.html#default-keep-remote-files. Remove this from the config and you should be go.

Thanks

Jordan

Perfect, removing the environment variable has solved the problem.

Thanks a lot for your help.

Yann