根据 ansible 网站的说明,Ansible 是从 github 安装的,并且似乎运行正常。但是 galaxy 失败了,如下所示:
# ansible-galaxy -vvv install goozbach.epel
Using /etc/ansible/ansible.cfg as config file
Opened /home/alf/.ansible_galaxy
Validate TLS certificates: True
Connecting to galaxy_server: https://galaxy.ansible.com
Base API: https://galaxy.ansible.com/api/v1
ERROR! Unexpected Exception: 'Galaxy' object has no attribute 'roles_paths'
the full traceback was:
Traceback (most recent call last):
File "/opt/ansible/bin/ansible-galaxy", line 86, in <module>
sys.exit(cli.run())
File "/opt/ansible/lib/ansible/cli/galaxy.py", line 153, in run
self.execute()
File "/opt/ansible/lib/ansible/cli/__init__.py", line 114, in execute
fn()
File "/opt/ansible/lib/ansible/cli/galaxy.py", line 394, in execute_install
roles_left.append(GalaxyRole(self.galaxy, **role))
File "/opt/ansible/lib/ansible/galaxy/role.py", line 70, in __init__
for path in galaxy.roles_paths:
AttributeError: 'Galaxy' object has no attribute 'roles_paths'
同样的设置在 CentOS6 机器上工作正常(FC22 是我的笔记本电脑)。我怀疑安装过程中存在一些问题(缺少 python 库或其他问题),但目前还没有发现任何问题。
编辑:我可以通过替换 /opt/ansible/lib/ansible/galaxy/role.py 中第 70 行和第 77 行中的 galaxy.roles_paths 和 galaxy.options.roles_path 来安装它 - 检查 pdb 中的 galaxy 对象,属性 role_paths 确实不存在。不过,理解为什么应该如此又是另一回事。