我正在本地使用 Ansible 配置自己的机器,今天(我有一段时间没有运行剧本了)它突然开始挂起。我似乎根本无法运行任何剧本,至少在本地无法运行。我在一个新的工作场所,没有任何远程主机可供测试。
我正在使用 Ansible 2.7.1
,在精简版 Ubuntu 上运行18.04
。
ansible.cfg
:
[defaults]
inventory=inventory
inventory
:
localhost ansible_connection=local
test
(剧本):
---
- name: Test
hosts: all
tasks:
- debug:
msg: "I'm alive"
输出如下:
$ ansible-playbook -vvvv test
ansible-playbook 2.7.1
config file = /home/tjarvstrand/playbooks/mini.iso/ansible.cfg
configured module search path = [u'/home/tjarvstrand/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/lib/python2.7/dist-packages/ansible
executable location = /usr/local/bin/ansible-playbook
python version = 2.7.15rc1 (default, Apr 15 2018, 21:51:34) [GCC 7.3.0]
Using /home/tjarvstrand/playbooks/mini.iso/ansible.cfg as config file
setting up inventory plugins
/home/tjarvstrand/playbooks/mini.iso/inventory did not meet host_list requirements, check plugin documentation if this is unexpected
/home/tjarvstrand/playbooks/mini.iso/inventory did not meet script requirements, check plugin documentation if this is unexpected
Set default localhost to localhost
Parsed /home/tjarvstrand/playbooks/mini.iso/inventory inventory source with ini plugin
分析完库存后,一片寂静。请帮忙
编辑:我也测试过inventory
:
localhost ansible_connection=ssh
结果相同。
EDIT2:
ansible -vvvv all -m ping
输出:
ansible 2.7.1
config file = /home/tjarvstrand/playbooks/mini.iso/ansible.cfg
configured module search path = [u'/home/tjarvstrand/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/lib/python2.7/dist-packages/ansible
executable location = /usr/local/bin/ansible
python version = 2.7.15rc1 (default, Apr 15 2018, 21:51:34) [GCC 7.3.0]
Using /home/tjarvstrand/playbooks/mini.iso/ansible.cfg as config file
setting up inventory plugins
/home/tjarvstrand/playbooks/mini.iso/inventory did not meet host_list requirements, check plugin documentation if this is unexpected
/home/tjarvstrand/playbooks/mini.iso/inventory did not meet script requirements, check plugin documentation if this is unexpected
Set default localhost to localhost
Parsed /home/tjarvstrand/playbooks/mini.iso/inventory inventory source with ini plugin
Loading callback plugin minimal of type stdout, v2.0 from /usr/local/lib/python2.7/dist-packages/ansible/plugins/callback/minimal.pyc
META: ran handlers
然后挂起
答案1
事实证明这是用户错误。我有一个本地 ssh 包装器,它把事情搞得一团糟。我仍然不明白为什么这会导致本地连接出现问题,但至少现在我可以解决这个问题了。