【发布时间】:2017-09-14 14:46:08
【问题描述】:
我正在尝试做一个简单的 Ansible 脚本来在 EC2 中附加一个卷
- ec2_vol:
instance: XXXXXX
volume_size: 5
device_name: sdd
运行时出现以下错误
msg": "区域 eu-central-1 似乎不适用于 aws 模块 boto.ec2。如果该区域确实存在,您可能需要 升级 boto 或使用 endpoints_path 扩展"
当我检查 eu-central-1 是否可以通过 python boto 访问时......它就在那里:
$ python
Python 2.7.12 (default, Nov 19 2016, 06:48:10)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import boto.ec2
>>> boto.ec2.regions()
[RegionInfo:us-west-1, RegionInfo:us-east-1, RegionInfo:ap-northeast-1, RegionInfo:ap-southeast-2, RegionInfo:sa-east-1, RegionInfo:ap-northeast-2, RegionInfo:us-east-2, RegionInfo:ap-southeast-1, RegionInfo:ca-central-1, RegionInfo:cn-north-1, RegionInfo:us-west-2, RegionInfo:us-gov-west-1, RegionInfo:ap-south-1, RegionInfo:eu-central-1, RegionInfo:eu-west-1, RegionInfo:eu-west-2]
这是我的工具的版本
ansible 2.3.2.0
aws-cli 1.11.151
Python 2.7.12
Linux 4.4.0-93-generic
botocore 1.7.9
boto 2.48.0
pip 9.0.1
我已经检查了我能想到的大部分内容,甚至使用 vagrant 在另一个虚拟机上重现它,它给了我同样的错误..我还能检查什么?
【问题讨论】:
-
尝试安装
boto并测试,你只有botocore -
我有 boto (2.48.0)
-
然后显示您正在运行的完整剧本以获取该错误
-
就是一个简单的:
--- - name: Add volume hosts: '{{ target }}' sudo: no tasks: - name: Attach volume to instance ec2_vol: region: "eu-central-1" instance: "i-0123456aaaaaaaaaa" volume_size: 10 device_name: sdd -
你用
connection: local运行这个吗?
标签: python amazon-ec2 ansible