Ansible-主机列表拒绝解析/etc/Ansible/hosts,因为它没有通过它';s verify_file()方法

Ansible-主机列表拒绝解析/etc/Ansible/hosts,因为它没有通过它';s verify_file()方法,ansible,Ansible,我的本地/etc/ansible/hosts文件刚刚 [example] 172.31.nn.nnn 为什么我会这样 host_list declined parsing /etc/ansible/hosts as it did not pass it's verify_file() method 消息 如果我把它改成 [local] localhost ansible_connection=local 它似乎工作正常。 但这仅限于当地。我想从本地计算机ping我的aws实例 完整信息:

我的本地
/etc/ansible/hosts
文件刚刚

[example]
172.31.nn.nnn
为什么我会这样

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

如果我把它改成

[local]
localhost ansible_connection=local
它似乎工作正常。 但这仅限于当地。我想从本地计算机ping我的aws实例

完整信息:

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
}
ansible 2.8.0
配置文件=/etc/ansible/ansible.cfg
配置的模块搜索路径=[u'/home/michael/.ansible/plugins/modules',u'/usr/share/ansible/plugins/modules']
ansible python模块位置=/home/michael/.local/lib/python2.7/site-packages/ansible
可执行文件位置=/usr/bin/ansible
python版本=2.7.15rc1(默认值,2018年11月12日,14:31:15)[GCC 7.3.0]
使用/etc/ansible/ansible.cfg作为配置文件
设置目录插件
host_list拒绝解析/etc/ansible/hosts,因为它没有通过其verify_file()方法
脚本拒绝解析/etc/ansible/hosts,因为它没有通过其verify_file()方法
自动拒绝解析/etc/ansible/hosts,因为它未通过其verify_file()方法
使用ini插件解析的/etc/ansible/hosts清单源
正在从/home/michael/.local/lib/python2.7/site-packages/ansible/plugins/callb加载stdout类型的最小回调插件v2.0
ack/minimal.pyc
META:ran处理程序
为用户建立SSH连接:ubuntu
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带麦克风、gssapi-keyex、基于主机、p
publickey-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''
(255),“OpenSSH_7.6p1 Ubuntu-4ubuntu0.3,OpenSSL 1.0.2n 2017年12月7日\r\n错误1:读取配置数据/et
c/ssh/ssh\u config\r\ndebug1:/etc/ssh/ssh\u config第19行:应用*\r\ndebug1的选项:自动多路复用:尝试现有主\r\n
ebug1:控制套接字“/home/michael/.ansible/cp/7e7a30892f”不存在\r\n错误2:解析“172.31.40.133”端口22\r\n
g2:ssh\u connect\u direct:needpriv 0\r\n错误1:连接到172.31.40.133[172.31.40.133]端口22。\r\n错误2:fd 3设置为非
块\r\n错误1:连接到地址172.31.40.133端口22:连接超时\r\nssh:连接到主机172.31.40.133端口22:C
连接超时\r\n')
172.31.40.133 |遥不可及!=>{
“更改”:错误,
“msg”:“无法通过ssh连接到主机:OpenSSH_7.6p1 Ubuntu-4ubuntu0.3,OpenSSL 1.0.2n 2017年12月7日\r\n错误1:Readin
g配置数据/etc/ssh/ssh\u config\r\ndebug1:/etc/ssh/ssh\u配置第19行:应用*\r\ndebug1的选项:自动多路复用:尝试
ing现有主机\r\n错误1:控制套接字\“/home/michael/.ansible/cp/7e7a30892f\”不存在\r\n错误2:解析\“172
.31.40.133 \“端口22\r\n错误2:ssh\u connect\u direct:needpriv 0\r\n错误1:连接到172.31.40.133[172.31.40.133]端口22。\r\n
\ndebug2:fd 3设置O_NONBLOCK\r\n ndebug1:连接到地址172.31.40.133端口22:连接超时\r\nssh:连接到h
ost 172.31.40.133端口22:连接超时“,
“遥不可及”:真实
}
我尝试在顶部加载[inventory],还启用了_plugins=ini。第一个没有帮助,第二个给出了一条解析消息

仅供参考安全组信息:


有关拒绝解析的消息仅供参考。清单文件有几个不同的插件,您可以从输出中看到
ini
插件正在成功解析您的清单(
Parsed/etc/ansible/hosts inventory source with ini plugin

这个问题与Ansible无关。您需要首先建立到托管节点的ssh连接

值得一提的是,安全组设置看起来很好(假设它们应用于您的主机),因此主机本身可能存在问题(即内部防火墙或sshd未运行)