Amazon web services 用于下载文件的S3模块在ansible中不工作
这是为从S3 bucket“artefact test”下载文件而编写的ansible代码 我也设置了boto配置文件和aws配置文件。我有不同的错误,我认为这些错误是无效的,比如-Amazon web services 用于下载文件的S3模块在ansible中不工作,amazon-web-services,amazon-s3,ansible,boto,Amazon Web Services,Amazon S3,Ansible,Boto,这是为从S3 bucket“artefact test”下载文件而编写的ansible代码 我也设置了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-10
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
failed:[127.0.0.1]=>{“failed”:true,“parsed”:false}
回溯(最近一次呼叫最后一次):
文件“/home/dmittal/.ansible/tmp/ansible-tmp-1462436903.77-107775915578620/s3”,第2320行,中
main()
文件“/home/dmittal/.ansible/tmp/ansible-tmp-1462436903.77-107775915578620/s3”,第304行,主文件
ec2\u url、aws\u访问密钥、aws\u密钥、区域=获取ec2\u凭据(模块)
文件“/home/dmittal/.ansible/tmp/ansible-tmp-1462436903.77-107775915578620/s3”,第2273行,在get_ec2_creds中
区域,ec2\u url,boto\u参数=获取aws\u连接信息(模块)
文件“/home/dmittal/.ansible/tmp/ansible-tmp-1462436903.77-107775915578620/s3”,第2260行,在获取aws连接信息中
如果不是,则boto_支持_profile_name():
文件“/home/dmittal/.ansible/tmp/ansible-tmp-1462436903.77-107775915578620/s3”,第2191行,位于boto_supports_profile_名称中
返回hasattr(boto.ec2.ec2连接,'profile_name')
AttributeError:“模块”对象没有属性“ec2”
失败:[127.0.0.1]=>{“失败”:true}
msg:找不到目标存储桶
失败:[127.0.0.1]=>{“失败”:true}
msg:找不到目标密钥
而指定的bucket和key都存在于AWS上。如果我使用AWS-CLI命令执行相同的操作,同样的事情也会发生。似乎与此相关。您可能希望尝试在文件
ansible/module\u utils/ec2.py
-
import boto.ec2
类似这样的内容-您将访问和密钥存储在哪里?您的存储桶名称是否应该是“工件测试”而不是“工件测试”?您安装了什么版本的Ansible和什么版本的Boto?@Pumpkinsed:通常我将其保存在这里“~/.aws/credentials”对于所有模块都有效,但为此,我甚至创建了~/.boto来存储访问密钥和机密。@CarsonCole:bucket名称与AWS上存在的名称相同,代码中也提到了该名称。我也尝试了不同的bucket。
import boto.ec2