我在 CentOS 6.5 上安装 Ansible 时出现OSError:[Errno 2] 没有该文件或目录
[batandwa@localhost ansible]$ ansible-playbook -i hosts main.yml -v
[WARNING]: The version of gmp you have installed has a known issue regarding
timing vulnerabilities when used with pycrypto. If possible, you should update
it (ie. yum update gmp).
PLAY [all] ********************************************************************
GATHERING FACTS ***************************************************************
Traceback (most recent call last):
File "/usr/bin/ansible-playbook", line 317, in <module>
sys.exit(main(sys.argv[1:]))
File "/usr/bin/ansible-playbook", line 257, in main
pb.run()
File "/usr/lib/python2.6/site-packages/ansible/playbook/__init__.py", line 323, in run
if not self._run_play(play):
File "/usr/lib/python2.6/site-packages/ansible/playbook/__init__.py", line 624, in _run_play
self._do_setup_step(play)
File "/usr/lib/python2.6/site-packages/ansible/playbook/__init__.py", line 569, in _do_setup_step
accelerate_port=play.accelerate_port,
File "/usr/lib/python2.6/site-packages/ansible/runner/__init__.py", line 204, in __init__
cmd = subprocess.Popen(['ssh','-o','ControlPersist'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
File "/usr/lib64/python2.6/subprocess.py", line 642, in __init__
errread, errwrite)
File "/usr/lib64/python2.6/subprocess.py", line 1234, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
我运行的文件夹包含主办方,主目录和变量.yml。
甚至ansible -i hosts all -m ping
不起作用并返回相同的错误。
答案1
基于对 Google 上的 Ansible 项目组的评论,安装openssh 客户端为我修复了这个问题:
sudo yum install openssh-clients
答案2
这是 CentOS 6 上的 EPEL 软件包的一个问题。它是 ansible 依赖项的一个旧依赖项,如果升级可能会破坏其他东西,因此不确定 EPEL 中是否会对此采取任何措施。