2017-08-10 62 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證書,在本地卻不行遠程主機,所以你需要通過憑證到模塊,以便它可以用於遠程主機。

希望它可以幫助你