2017-08-10 76 views
0

我想从s3存储桶下载文件,我做了一个配置,并且还导出了我的访问密钥和密钥,但我仍然收到相同的错误。请给我建议Ansible错误 - 没有身份验证处理程序发现:

代码:

- name: Download xx tarball 
    s3: 
     bucket: xxx 
     object: folder/xx-commandline-4.0.3.tar.gz 
     dest: '/tmp/{{ xx_tarball }}' 
     mode: get 
    when: 'st.stat.exists == false' 

错误:

fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "msg": "No Authentication Handler found: No handler was ready to authenticate. 1 handlers were checked. ['HmacAuthV1Handler'] Check your credentials "} 


ansible --version 
ansible 2.0.0.2 



uname -a 
Linux ip-xx-xxx-xx-x 4.4.0-1026-aws #35-Ubuntu SMP Thu Jul 20 21:59:09 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux 
+0

确保您creds确实与AWS-CLI工作第一。 –

回答

0

您需要检查两件事情:

I- boto安装在目标主机上,您需要从s3下载文件:

sudo -H pip install boto 

II-如果这是远程主机的话请使用以下格式:

- name: Download xx tarball 
    s3: 
    aws_access_key: "{{ AWS_S3_ACCESS_KEY }}" 
    aws_secret_key: "{{ AWS_S3_SECRET_KEY }}" 
    bucket: xxx 
    object: folder/xx-commandline-4.0.3.tar.gz 
    dest: '/tmp/{{ xx_tarball }}' 
    mode: get 
    when: st.stat.exists == false 

注:当您导出AWS证书,在本地却不行远程主机,所以你需要通过凭证到模块,以便它可以用于远程主机。

希望它可以帮助你