Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ansible - host_list declined parsing /etc/ansible/hosts as it did not pass it's verify_file() method

Tags:

ansible

My local /etc/ansible/hosts file just has

[example]
172.31.nn.nnn

Why do I get that

host_list declined parsing /etc/ansible/hosts as it did not pass it's verify_file() method

message ?

If I change it to

[local]
localhost ansible_connection=local

it seems to work ok. But that is limited to local. I want to ping my aws instance from my local machine.

Full message:

ansible 2.8.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/home/michael/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /home/michael/.local/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.15rc1 (default, Nov 12 2018, 14:31:15) [GCC 7.3.0]
Using /etc/ansible/ansible.cfg as config file
setting up inventory plugins
host_list declined parsing /etc/ansible/hosts as it did not pass it's verify_file() method
script declined parsing /etc/ansible/hosts as it did not pass it's verify_file() method
auto declined parsing /etc/ansible/hosts as it did not pass it's verify_file() method
Parsed /etc/ansible/hosts inventory source with ini plugin
Loading callback plugin minimal of type stdout, v2.0 from /home/michael/.local/lib/python2.7/site-packages/ansible/plugins/callb
ack/minimal.pyc
META: ran handlers
<172.31.40.133> ESTABLISH SSH CONNECTION FOR USER: ubuntu
<172.31.40.133> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o 'IdentityFile="/home/michael/Dropbox/90_201
9/work/aws/rubymd2.pem"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,p
ublickey -o PasswordAuthentication=no -o 'User="ubuntu"' -o ConnectTimeout=10 -o ControlPath=/home/michael/.ansible/cp/7e7a30892
f 172.31.40.133 '/bin/sh -c '"'"'echo ~ubuntu && sleep 0'"'"''
<172.31.40.133> (255, '', 'OpenSSH_7.6p1 Ubuntu-4ubuntu0.3, OpenSSL 1.0.2n  7 Dec 2017\r\ndebug1: Reading configuration data /et
c/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: Applying options for *\r\ndebug1: auto-mux: Trying existing master\r\nd
ebug1: Control socket "/home/michael/.ansible/cp/7e7a30892f" does not exist\r\ndebug2: resolving "172.31.40.133" port 22\r\ndebu
g2: ssh_connect_direct: needpriv 0\r\ndebug1: Connecting to 172.31.40.133 [172.31.40.133] port 22.\r\ndebug2: fd 3 setting O_NON
BLOCK\r\ndebug1: connect to address 172.31.40.133 port 22: Connection timed out\r\nssh: connect to host 172.31.40.133 port 22: C
onnection timed out\r\n')
172.31.40.133 | UNREACHABLE! => {
    "changed": false, 
    "msg": "Failed to connect to the host via ssh: OpenSSH_7.6p1 Ubuntu-4ubuntu0.3, OpenSSL 1.0.2n  7 Dec 2017\r\ndebug1: Readin
g configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: Applying options for *\r\ndebug1: auto-mux: Try
ing existing master\r\ndebug1: Control socket \"/home/michael/.ansible/cp/7e7a30892f\" does not exist\r\ndebug2: resolving \"172
.31.40.133\" port 22\r\ndebug2: ssh_connect_direct: needpriv 0\r\ndebug1: Connecting to 172.31.40.133 [172.31.40.133] port 22.\r
\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug1: connect to address 172.31.40.133 port 22: Connection timed out\r\nssh: connect to h
ost 172.31.40.133 port 22: Connection timed out", 
    "unreachable": true
}

I tried ading [inventory] at the top and also enable_plugins = ini. The first didn't help and the second gave a parse message.

fyi security group info:

enter image description here

like image 406
Michael Durrant Avatar asked Jun 05 '19 17:06

Michael Durrant


1 Answers

The messages about declined parsing are informational only. There are several different plugins for inventory files, and you can see from the output that the ini plugin is successfully parsing your inventory (Parsed /etc/ansible/hosts inventory source with ini plugin).

This issue is unrelated to Ansible. You need to first establish ssh connectivity to your managed node.

For what it's worth, the security group settings appear fine (assuming they are applied to your host) so there could be an issue with the host itself (i.e. internal firewall or sshd not running).

like image 144
Matt P Avatar answered Nov 05 '22 16:11

Matt P