Error with win_ping playbook

212 views
Skip to first unread message

Yann

unread,
Sep 26, 2018, 8:09:07 AM9/26/18
to Ansible Project
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 ?

Jordan Borean

unread,
Sep 26, 2018, 8:16:17 AM9/26/18
to Ansible Project
Sounds like a playbook encoding issue.

Yann

unread,
Sep 26, 2018, 8:18:56 AM9/26/18
to Ansible Project
- hosts: "{{ app }}.{{ envt }}.winping"
  gather_facts: no
  tasks:
  - name: Test win_ping
    win_ping:

Jordan Borean

unread,
Sep 26, 2018, 3:11:13 PM9/26/18
to Ansible Project
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

Yann

unread,
Sep 27, 2018, 4:57:45 AM9/27/18
to Ansible Project
# 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
<xxxxxxxx> 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 <unbound method HTTPKerberosAuth.__init__> 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

===================================================================================================================

-- Debut execution playbook - winping --

ansible-playbook 2.4.2.0
  config file = /tmp/xxxxxxx/configuration/ansible_xxxxxxx.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-playbook
  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 /tmp/xxxxxxx/configuration/ansible_xxxxxxx.cfg as config file
Parsed /tmp/xxxxxxx/configuration/hosts_xxxxxxx inventory source with ini plugin

PLAYBOOK: Arret_Relance_Win_bas.yml ***************************************************************************************************************************************************************************
1 plays in Arret_Relance_Win_bas.yml

PLAY [bas.test.winping] ***************************************************************************************************************************************************************************************
META: ran handlers

TASK [Test de win_ping sur [bas.test.winping]] ****************************************************************************************************************************************************************
task path: /tmp/xxxxxxx/Arret_Relance_Win_bas.yml:6
Using module file /usr/lib/python2.6/site-packages/ansible/modules/windows/win_ping.ps1
<xxxxxxxx> ESTABLISH WINRM CONNECTION FOR USER: xxxxxxx on PORT 5986 TO xxxxxxxx
EXEC (via pipeline wrapper)
<xxxxxxxx> PUT "/tmp/tmpbJXmTv" TO "C:\Users\xxxxxxx\AppData\Local\Temp\ansible-tmp-1538038172.34-25609696399970\win_ping.ps1"

EXEC (via pipeline wrapper)
The full traceback is:
Au caract?re Ligne:4 : 3
+ & "C:\Users\xxxxxxx\Ap ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fatal: [ANS_yyyyyyyyy]: FAILED! => {
    "changed": false
}

MSG:

Le terme ??C:\Users\xxxxxxx\AppData\Local\Temp\ansible-tmp-1538038172.34-25609696399970\win_ping.ps1.ps1?? n'est pas reconnu comme nom d'applet de commande, fonction, fichier de script ou programme ex?cutable. V?rifiez l'orthographe du nom, ou si un chemin d'acc?s existe, v?rifiez que le chemin d'acc?s est correct et r?essayez.

PLAY RECAP ****************************************************************************************************************************************************************************************************
ANS_yyyyyyyyy               : ok=0    changed=0    unreachable=0    failed=1

===================================================================================================================

# ansible-config dump --only-changed
/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_SSH_ARGS(/etc/ansible/ansible.cfg) = -o GSSAPIAuthentication=yes -o UserKnownHostsFile=/home/ldap/.ssh/known_hosts
DEFAULT_BECOME(/etc/ansible/ansible.cfg) = False
DEFAULT_BECOME_ASK_PASS(/etc/ansible/ansible.cfg) = False
DEFAULT_BECOME_METHOD(/etc/ansible/ansible.cfg) = dzdo
DEFAULT_HOST_LIST(/etc/ansible/ansible.cfg) = [u'/etc/ansible/hosts']
DEFAULT_LOCAL_TMP(/etc/ansible/ansible.cfg) = /tmp/xxxxxxx/tmp/ansible-local-50563WcZkEl
DEFAULT_REMOTE_TMP(/etc/ansible/ansible.cfg) = /tmp/$USER/ansible
DEFAULT_SCP_IF_SSH(/etc/ansible/ansible.cfg) = True
HOST_KEY_CHECKING(/etc/ansible/ansible.cfg) = False
RETRY_FILES_ENABLED(/etc/ansible/ansible.cfg) = False

# cat bas.test.winping
ansible_port: 5986
ansible_connection: winrm
ansible_winrm_transport: ntlm
ansible_user: xxxxxxx
ansible_password: ppppppppppp
#ansible_winrm_transport: kerberos
ansible_winrm_server_cert_validation: ignore

I used the NTLM protocol and Kerberos, I have the same error.
Thanks for your aid.

Jordan Borean

unread,
Sep 27, 2018, 7:24:01 AM9/27/18
to Ansible Project
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

Yann

unread,
Sep 27, 2018, 9:06:02 AM9/27/18
to Ansible Project
Perfect, removing the environment variable has solved the problem.
Thanks a lot for your help.

Yann
Reply all
Reply to author
Forward
0 new messages