S3 module for downloading files is not working in ansible

匿名 (未验证) 提交于 2019-12-03 01:03:01

问题:

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 }}" 

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 

Whereas the bucket and key specified both exists on AWS.The same thing works if i use AWS-CLI commands to do the same.

回答1:

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 

Something like this - https://github.com/ansible/ansible/blob/9cf43ce17f20171b5740a6e0773f666cb47e2d5e/lib/ansible/module_utils/ec2.py#L31



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!