【发布时间】:2015-08-02 09:32:26
【问题描述】:
使用 Ansible 1.9.1 版:
ansible --version
ansible 1.9.1
在 Ubuntu 14.04.2 LTS 上
lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04.2 LTS
Release: 14.04
Codename: trusty
我正在使用 Ansible rds 模块来创建数据库:
- 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
我想向数据库添加标签,但是当我运行我的剧本时,我收到以下错误:
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 的输出和...
$ python -c 'import boto; print boto.__version__'
2.38.0
我正在运行virtualenv。已尝试将 PYTHONPATH 设置为显式指向 boto 在 virtualenv 中的位置,但没有骰子。
谁能看出我做错了什么?
【问题讨论】:
-
你能在 ansible 中运行同样的命令,看看它会打印出什么吗?
标签: python amazon-web-services boto ansible rds