【发布时间】:2015-04-24 21:19:41
【问题描述】:
我对您应该如何使用 Ansible 启动 EC2 实例感到非常困惑。
我正在尝试使用 ec2.py 库存脚本。我不确定应该使用哪一个,因为 Ansible 安装了三个:
- ansible/lib/ansible/module_utils/ec2.py
- ansible/lib/ansible/modules/core/cloud/amazon/ec2.py
- ansible/plugins/inventory/ec2.py
我认为在inventory/中运行它最有意义,所以我使用:
ansible-playbook launch-ec2.yaml -i ec2.py
这给了我:
msg: Either region or ec2_url must be specified
所以我添加了一个区域(即使我指定了 vpc_subnet_id),我得到:
msg: Region us-east-1e does not seem to be available for aws module boto.ec2. If the region definitely exists, you may need to upgrade boto or extend with endpoints_path
我在想亚马逊一定是最近更改了 ec2,所以您需要使用 VPC?即使我尝试从 Amazon 的控制台启动实例,“EC2 Classic”选项也被禁用。
当我尝试在 cloud/amazon/ 中使用 ec2.py 脚本时,我得到:
ERROR: Inventory script (/software/ansible/lib/ansible/modules/core/cloud/amazon/ec2.py) had an execution error:
没有比这更多的细节了。
经过一番搜索,我看到 /module_utils has been changed 中有 ec2.py 模块,因此不需要指定区域。我尝试运行此文件但得到:
错误:文件 /software/ansible/lib/ansible/module_utils/ec2.py 被标记为可执行文件,但未能正确执行。如果这不应该是可执行脚本,请使用chmod -x /software/ansible/lib/ansible/module_utils/ec2.py 进行更正。
因此,正如错误提示,我删除了 ec2.py 文件的可执行权限,但随后出现以下错误:
ERROR: /software/ansible/lib/ansible/module_utils/ec2.py:30: Invalid ini entry: distutils.version - need more than 1 value to unpack
有没有人对如何让它工作有任何想法?要使用的正确文件是什么?在这一点上,我完全不知道如何让它发挥作用。
【问题讨论】: