ping is not working

139 views
Skip to first unread message

Ebrahim Kutty

unread,
May 15, 2019, 5:34:43 AM5/15/19
to Ansible Project
When I test ping command with ansible, I am getting the below error, (red colored)

/etc/ansible$ more hosts

/etc/ansible$ more ansible.cfg 
[defaults]
remote_tmp = /tmp/ansible-$USER
#remote_tmp = $HOME/.ansible/tmp
local_tmp = $HOME/.ansible/tmp

--------------------------------------------------------------------------------------------------------
ebrahim@ebrahim-pc:/etc/ansible$ ansible all -m ping
ro...@192.168.100.128 | FAILED! => {
    "changed": false, 
    "module_stderr": "Shared connection to 192.168.100.128 closed.\r\n", 
    "module_stdout": "  File \"/tmp/ansible-root/ansible-tmp-1557907388.83-40454918869493/AnsiballZ_ping.py\", line 39\r\n    with open(module, 'wb') as f:\r\n            ^\r\nSyntaxError: invalid syntax\r\n",                                                                                                                                                   
    "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", 
    "rc": 1
-------------------------------------------------------------------------------------------------------------

Kai Stian Olstad

unread,
May 15, 2019, 8:57:14 AM5/15/19
to ansible...@googlegroups.com
On 15.05.2019 11:34, Ebrahim Kutty wrote:
> When I test ping command with ansible, I am getting the below error,
> (red
> colored)
>
> /etc/ansible$ more hosts
> ro...@192.168.100.128

This is not correct inventory syntax
https://docs.ansible.com/ansible/latest/user_guide/intro_inventory.html

look at the ansible_user in the link

--
Kai Stian Olstad

Brian Coca

unread,
May 15, 2019, 11:04:28 AM5/15/19
to Ansible Project
The error suggests your target has a very old version of python `with`
was introduced in Python 2.6 (iirc), which is the minimum supported by
current versions of Ansible.
Support for older versions of Python was dropped in Ansible 2.4.

You probably need to upgrade the python on the target and/or point to
a newer version via ansible_python_inteprteter

@kai, user@host is valid inventory syntax, it is not something we
recommend but it does work.
--
----------
Brian Coca

Ebrahim Kutty

unread,
May 16, 2019, 2:59:09 AM5/16/19
to Ansible Project
Yes, it is correct. the python version on the target is 2.4.

Thanks for your valuable answer.

Shan Mugarajan

unread,
May 16, 2019, 3:02:45 AM5/16/19
to ansible...@googlegroups.com
Make sure your are typing the password as the authentication mechanism may be keyboard interactive for the ssh user by passing -k option when running the command

--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/efddcea0-89d8-4f34-b141-14973e6171c7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages