-1

I've just getting started to study Ansible and how it can improves my job. With that said, I'm facing issues when I try to ping a host with Ansible (ansible all -m ping -vv). Ansible is installed on host A and host B is configured on /etc/ansible/hosts. Both hosts run Ubuntu 16.04.03 LTS and I can SSH from A to B without password.

Ansible ping returns

172.28.25.81 | FAILED! => {
    "changed": false, 
    "failed": true, 
    "module_stderr": "Shared connection to 172.28.25.81 closed.\r\n", 
    "module_stdout": "/bin/sh: 1: /usr/bin/python: not found\r\n", 
    "msg": "MODULE FAILURE", 
    "rc": 0
}

My software versions are:

  • Ansible 2.4.1.0
  • Python 2.7.12
1
  • 2
    What is the question?
    – techraf
    Nov 16, 2017 at 2:48

1 Answer 1

5

Since you started using Ansible, I believe you read what ping module is for (reading just the header is enough in this case):

ping - Try to connect to host, verify a usable python and return pong on success

Ansible tells you:

/bin/sh: 1: /usr/bin/python: not found

So it likely could not "verify a usable python".


And there is a reason for that: Ubuntu 16.04 does not come with Python 2 installed, so Ansible fails to run /usr/bin/python executable.

You need to:

  • install Python 2 on the target machine, or
  • instruct Ansible to use Python 3 (it's working, but is not yet officially supported) - there is a ansible_python_interpreter setting for that.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .