ansible playbook is failing with windows hosts

99 views
Skip to first unread message

Vowner

unread,
Sep 9, 2019, 4:09:10 PM9/9/19
to Ansible Project
Hi Experts,

My ansible playbook of simple ping  module is failing with my windows host. 

My Playbbok

---

- name: check ping status
  hosts: all
  tasks:
    - name: ping servers
      ping:


My Hostfile entry 

[DEV]
[DEV:vars]

#ansible_password=
ansible_connection=winrm
ansible_port=5986
ansible_winrm_transport=kerberos
ansible_winrm_server_cert_validation=ignore



Error

[root@localhost pw]# ansible-playbook -k ping.yml
/usr/lib/python2.7/site-packages/cryptography-2.7-py2.7-linux-x86_64.egg/cryptography/hazmat/bindings/openssl/binding.py:163: CryptographyDeprecationWarning: OpenSSL version 1.0.1 is no longer supported by the OpenSSL project, please upgrade. A future version of cryptography will drop support for it.
  utils.CryptographyDeprecationWarning
SSH password:

PLAY [check ping status] ************************************************************************************************************************************

TASK [Gathering Facts] **************************************************************************************************************************************
/usr/lib/python2.7/site-packages/urllib3/connectionpool.py:769: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html
  InsecureRequestWarning)
/usr/lib/python2.7/site-packages/requests_kerberos/kerberos_.py:160: NoCertificateRetrievedWarning: Requests is running with a non urllib3 backend, cannot retrieve server certificate for CBT
  NoCertificateRetrievedWarning)

TASK [ping servers] *****************************************************************************************************************************************
/usr/lib/python2.7/site-packages/urllib3/connectionpool.py:769: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html
  InsecureRequestWarning)
/usr/lib/python2.7/site-packages/requests_kerberos/kerberos_.py:160: NoCertificateRetrievedWarning: Requests is running with a non urllib3 backend, cannot retrieve server certificate for CBT
  NoCertificateRetrievedWarning)
 [WARNING]: No python interpreters found for host MYHOST.MYDOMAIN.COM (tried ['/usr/bin/python', 'python3.7', 'python3.6', 'python3.5', 'python2.7',
'python2.6', '/usr/libexec/platform-python', '/usr/bin/python3', 'python'])

fatal: [MYHOST.MYDOMAIN.COM]: FAILED! => {"ansible_facts": {"discovered_interpreter_python": "/usr/bin/python"}, "changed": false, "module_stderr": "Exception calling \"Create\" with \"1\" argument(s): \"At line:4 char:21\r\n+ def _ansiballz_main():\r\n+                     ~\r\nAn expression was expected after '('.\r\nAt line:13 char:27\r\n+     except (AttributeError, OSError):\r\n+                           ~\r\nMissing argument in parameter list.\r\nAt line:15 char:7\r\n+     if scriptdir is not None:\r\n+       ~\r\nMissing '(' after 'if' in if statement.\r\nAt line:22 char:7\r\n+     if sys.version_info < (3,):\r\n+       ~\r\nMissing '(' after 'if' in if statement.\r\nAt line:22 char:30\r\n+     if sys.version_info < (3,):\r\n+                              ~\r\nMissing expression after ','.\r\nAt line:22 char:25\r\n+     if sys.version_info < (3,):\r\n+                         ~\r\nThe '<' operator is reserved for future use.\r\nAt line:24 char:32\r\n+         MOD_DESC = ('.py', 'U', imp.PY_SOURCE)\r\n+                                ~\r\nMissing expression after ','.\r\nAt line:24 char:33\r\n+         MOD_DESC = ('.py', 'U', imp.PY_SOURCE)\r\n+                                 ~~~~~~~~~~~~~\r\nUnexpected token 'imp.PY_SOURCE' in expression or statement.\r\nAt line:24 char:32\r\n+         MOD_DESC = ('.py', 'U', imp.PY_SOURCE)\r\n+                                ~\r\nMissing closing ')' in expression.\r\nAt line:24 char:46\r\n+         MOD_DESC = ('.py', 'U', imp.PY_SOURCE)\r\n+                                              ~\r\nUnexpected token ')' in expression or statement.\r\nNot all parse errors were reported.  Correct the reported errors and try again.\r\n\"\r\nAt line:6 char:1\r\n+ $exec_wrapper = [ScriptBlock]::Create($split_parts[0])\r\n+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException\r\n    + FullyQualifiedErrorId : ParseException\r\n \r\nThe expression after '&' in a pipeline element produced an object that was not \r\nvalid. It must result in a command name, a script block, or a CommandInfo \r\nobject.\r\nAt line:7 char:2\r\n+ &$exec_wrapper\r\n+  ~~~~~~~~~~~~~\r\n    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException\r\n    + FullyQualifiedErrorId : BadExpression\r\n ", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}

PLAY RECAP **************************************************************************************************************************************************
MYHOST.MYDOMAIN.COM          : ok=1    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0


Kai Stian Olstad

unread,
Sep 9, 2019, 5:41:34 PM9/9/19
to ansible...@googlegroups.com
On 09.09.2019 22:09, Vowner wrote:
> Hi Experts,
>
> My ansible playbook of simple ping module is failing with my windows host.
>
> My Playbbok
>
> ---
>
> - name: check ping status
> hosts: all
> tasks:
> - name: ping servers
> ping:

I suggest reading the documentation on the ping module.
Especially "Synopsis" part and the "See Also" part.


--
Kai Stian Olstad

MKPhil

unread,
Sep 10, 2019, 4:10:28 AM9/10/19
to Ansible Project
For windows hosts, use win_ping
Reply all
Reply to author
Forward
0 new messages