ansible 在 OSX 上找不到 pycurl [英] ansible can't find pycurl on OSX

查看:23
本文介绍了ansible 在 OSX 上找不到 pycurl的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚开始使用 ansible,我正在尝试让它与 OSX Yosemite 的 linode 模块一起工作.我正在使用 brew 安装的 Python 和 pip 安装的 ansible.所以我做了以下事情:

I'm just getting started with ansible, and I'm trying to get it to work with the linode module from OSX Yosemite. I'm using brew-installed Python, and pip-installed ansible. So I have done the following:

$ 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

当我运行我的剧本时,我得到:

When I run my playbook I get:

failed=True msg='pycurl required for this module'

不知何故,ansible 没有看到 pycurl 库.

So somehow ansible is not seeing the pycurl library.

这是剧本:

---
- 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

推荐答案

ubuntu 上也出现这种情况,终于找到解决方案了.您需要明确地将路径传递给 python 可执行文件

It's happening on ubuntu as well, finally figured out the solution. You need to explicity pass path to python executable

[local]
localhost

[local]
localhost ansible_python_interpreter=/usr/local/bin/python

或到您的虚拟环境 python 路径.

or to your virtual environment python path.

这篇关于ansible 在 OSX 上找不到 pycurl的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆