【发布时间】:2016-08-30 23:12:18
【问题描述】:
这是为从 S3 存储桶“artefact-test”下载文件而编写的 ansible 代码。
- name: Download customization artifacts from S3
s3:
bucket: "artefact-test"
object: "cust/gitbranching.txt"
dest: "/home/ubuntu/"
mode: get
region: "{{ s3_region }}"
profile: "{{ s3_profile }}"
我也设置了 boto 配置文件和 aws 配置文件。我得到了不同的错误,我认为这些错误是无效的 -
failed: [127.0.0.1] => {"failed": true, "parsed": false}
Traceback (most recent call last):
File "/home/dmittal/.ansible/tmp/ansible-tmp-1462436903.77-107775915578620/s3", line 2320, in <module>
main()
File "/home/dmittal/.ansible/tmp/ansible-tmp-1462436903.77-107775915578620/s3", line 304, in main
ec2_url, aws_access_key, aws_secret_key, region = get_ec2_creds(module)
File "/home/dmittal/.ansible/tmp/ansible-tmp-1462436903.77-107775915578620/s3", line 2273, in get_ec2_creds
region, ec2_url, boto_params = get_aws_connection_info(module)
File "/home/dmittal/.ansible/tmp/ansible-tmp-1462436903.77-107775915578620/s3", line 2260, in get_aws_connection_info
if not boto_supports_profile_name():
File "/home/dmittal/.ansible/tmp/ansible-tmp-1462436903.77-107775915578620/s3", line 2191, in boto_supports_profile_name
return hasattr(boto.ec2.EC2Connection, 'profile_name')
AttributeError: 'module' object has no attribute 'ec2'
failed: [127.0.0.1] => {"failed": true}
msg: Target bucket cannot be found
failed: [127.0.0.1] => {"failed": true}
msg: Target key cannot be found
而指定的存储桶和密钥都存在于 AWS 上。如果我使用 AWS-CLI 命令来做同样的事情,同样的事情会起作用。
【问题讨论】:
-
您将访问权限和密钥存储在哪里?
-
您的存储桶名称应该是“artifact-test”而不是“artifact-test”吗?
-
你安装的是什么版本的 Ansible 和什么版本的 Boto?
-
@PumpkinSeed :通常我将它保存在这里“~/.aws/credentials”并适用于所有模块,但为此我什至创建 ~/.boto 来存储访问密钥和秘密。
-
@CarsonCole:存储桶名称与 AWS 上存在的存储桶名称相同,代码中也提到过。我也尝试了不同的存储桶。
标签: amazon-web-services amazon-s3 ansible boto