Wednesday, October 21, 2015

Error while connecting to host from Ansible

Below error message I receive while trying to run(ping) command from Ansible master to hosts:

ubuntu@master:~/.ssh$ ansible 10.0.3.90 -m ping -k -u ubuntu
SSH password:
10.0.3.90 | FAILED >> {
    "failed": true,
    "msg": "/bin/sh: 1: /usr/bin/python: not found\r\nOpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: Applying options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug1: mux_client_request_session: master session id: 2\r\nShared connection to 10.0.3.90 closed.\r\n",
    "parsed": false
}


It seems from the error message that python is not installed on the machine. 

check python -v 

install via below command

$sudo apt-get install python-support

Now I executed the command again, this time it worked!

ubuntu@master:~/.ssh$ ansible 10.0.3.90 -m ping -u ubuntu
10.0.3.90 | success >> {
    "changed": false, 
    "ping": "pong"
}