我刚开始使用ansible,我正试图让它与OSX Yosemite的linode
模块一起使用。我正在使用brew安装的Python,以及pip-installed ansible。所以我做了以下事情:
$ brew install python
$ PYCURL_SSL_LIBRARY=nss pip install pycurl
$ CFLAGS=-Qunused-arguments CPPFLAGS=-Qunused-arguments pip install ansible
测试:
$ which python
/usr/local/bin/python
$ python --version
Python 2.7.9
$ which ansible
/usr/local/bin/ansible
$ ansible --version
ansible 1.8.2
configured module search path = None
当我运行我的剧本时,我得到:
failed=True msg='pycurl required for this module'
所以ansible不会看到pycurl
库。
这是剧本:
---
- hosts: 127.0.0.1
connection: local
gather_facts: no
tasks:
- name: "provision a server"
local_action:
module: linode
api_key: FOO
name: linode-test1
plan: 1
datacenter: 1
distribution: 99
password: 'superSecureRootPassword'
ssh_pub_key: ssh-rsa FOO
swap: 768
wait: yes
wait_timeout: 600
state: present
答案 0 :(得分:1)
它也在ubuntu上发生,终于找到了解决方案。您需要明确地将路径传递给python可执行文件
从
更改Ansible主机文件[local]
localhost
到
[local]
localhost ansible_python_interpreter=/usr/local/bin/python
或您的虚拟环境python路径。
答案 1 :(得分:0)
我能够通过编辑hosts
在OS X El Capitan 10.11.6上修复此问题:
[local]
localhost ansible_python_interpreter=/usr/local/bin/python
您可能需要其他Python依赖项:
pip install pycurl
pip install linode-python