首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >即使安装了boto 2.38.0,Ansible reports也需要boto.rds (boto >= 2.26.0)

即使安装了boto 2.38.0,Ansible reports也需要boto.rds (boto >= 2.26.0)
EN

Stack Overflow用户
提问于 2015-05-21 06:30:50
回答 1查看 443关注 0票数 0

使用Ansible版本1.9.1:

代码语言:javascript
复制
ansible --version
ansible 1.9.1

在Ubuntu 14.04.2 LTS上

代码语言:javascript
复制
lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 14.04.2 LTS
Release:    14.04
Codename:   trusty

我正在使用Ansible rds模块创建一个数据库:

代码语言:javascript
复制
- hosts: localhost
  gather_facts: False
  sudo: no

  tasks:

    - name: get-boto-version
      local_action: command python -c 'import boto; print boto.__version__'

    - name: Launch RDS instances
      rds:
        region: eu-west-1
        ec2_access_key: "{{ ec2_access_key }}"
        ec2_secret_key: "{{ ec2_secret_key }}"
        command: create
        instance_name: test
        instance_type: db.m1.small
        tags:
          this: that
        db_engine: MySQL
        size: 10
        username: foo
        password: foobar1000
        vpc_security_groups: this
        subnet: that

我想向数据库添加标签,但是当我运行我的剧本时,我得到了以下错误:

代码语言:javascript
复制
    ansible-playbook -i ec2 simple-db.yml --extra-vars "ec2_access_key=${AWS_ACCESS_KEY_ID} ec2_secret_key=${AWS_SECRET_ACCESS_KEY}" -v

    PLAY [localhost] ************************************************************** 

    TASK: [get-boto-version] ****************************************************** 
    changed: [127.0.0.1 -> 127.0.0.1] => {"changed": true, "cmd": ["python", "-c", "import boto; print boto.__version__"], "delta": "0:00:00.138097", "end": "2015-05-21 08:36:55.233037", "rc": 0, "start": "2015-05-21 08:36:55.094940", "stderr": "", 
    "stdout": "2.38.0", "warnings": []}

    TASK: [Launch RDS instances] ************************************************** 
    failed: [127.0.0.1] => {"failed": true}
    msg: Parameter tags requires boto.rds (boto >= 2.26.0)

    FATAL: all hosts have already failed -- aborting

    PLAY RECAP ******************************************************************** 
               to retry, use: --limit @/home/chris/simple-db.retry

    127.0.0.1                  : ok=1    changed=1    unreachable=0    failed=1

尽管安装了较新版本的boto,但仍会出现这种情况。请参阅上面任务get-boto-version的输出和...

代码语言:javascript
复制
$ python -c 'import boto; print boto.__version__'
2.38.0

我在virtualenv中运行。我已尝试将PYTHONPATH设置为显式指向virtualenvboto的位置,但没有结果。

有没有人看到我做错了什么?

EN

回答 1

Stack Overflow用户

发布于 2015-05-21 18:02:49

作为清单变量(在$project_root/group_vars/all$project_root/host_vars/localhost中),指定:

代码语言:javascript
复制
#$project_root/group_vars/all or #host_vars/localhost
ansible_python_interpreter='/usr/bin/env python'

或者直接在清单文件中,如下所示:

代码语言:javascript
复制
# inventory file
localhost ansible_python_interpreter='/usr/bin/env python'

这应该会让你准备好了。

默认情况下,Ansible不会拾取env python。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/30361478

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档