用于下载文件的 S3 模块在 ansible 中不起作用 [英] S3 module for downloading files is not working in ansible
本文介绍了用于下载文件的 S3 模块在 ansible 中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是为从 S3 存储桶artefact-test"下载文件而编写的 ansible 代码.
This is the ansible code written for downloading files from S3 bucket "artefact-test".
- 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 配置文件.我收到不同的错误,我认为这些错误无效 -
I have set the boto profile and aws profile too. I get different errors which i dont think are valid like -
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 命令来做同样的事情,同样的事情也会起作用.
Whereas the bucket and key specified both exists on AWS.The same thing works if i use AWS-CLI commands to do the same.
推荐答案
似乎有一个 错误.您可能想尝试在文件 ansible/module_utils/ec2.py
-
There seems to have been a bug related to this. You might want to try adding the following import statement in the file ansible/module_utils/ec2.py
-
import boto.ec2
这篇关于用于下载文件的 S3 模块在 ansible 中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文