If you are getting a 403 error, then either you don't have the permissions you think you do, or you are not accessing AWS as the user you think you are.
Carry out the desired operation using the command line while logged in (to localhost) as the user you think Ansible is using. If that works, then you 100% are using a different user in Ansible. If it doesn't work, then you don't have the permissions you think you do. For example, while logged in locally as "ansible": aws s3 mb s3://this_is_amits_bucket aws s3api head-bucket --bucket this_is_amits_bucket If the bucket already exists, just use the second command. Depending on how you have set up your AWS credentials, you may need to add "--profile whatever" to the commands, and possibly also "--region whatever". One other possibility is that the credentials the "ansible" user is using are set up with MFA in AWS. If that's the case, the above commands will prompt you for an MFA code. Regards, K. On Sun, Aug 25, 2019 at 11:02 AM Amit Kulkarni <[email protected]> wrote: > IAM user has full permission on S3. > > Let me know what additional information needed. > > Regards > Amit > > On Sat, Aug 24, 2019 at 8:57 PM Karl Auer <[email protected]> wrote: > >> More info needed. Check the credentials you are using and the permissions >> they provide. >> >> Regards, K. >> >> >> On Sun, Aug 25, 2019 at 10:42 AM Amit Kulkarni <[email protected]> >> wrote: >> >>> I was able to over the credentials issue >>> But getting 403 error as head bucket forbidden issue. >>> >>> Regards >>> Amit >>> >>> On Sat, Aug 24, 2019, 8:38 PM Karl Auer <[email protected]> wrote: >>> >>>> I haven't had a close look, but I think the problem is that while you >>>> are logged in as ansible, your playbook thn connects to localhost as root. >>>> and root does not have AWS credentials set up. From your output: >>>> >>>> [...] >>>> ESTABLISH LOCAL CONNECTION FOR USER: root >>>> [...] >>>> NoCredentialsError: Unable to locate credentials >>>> [...] >>>> >>>> In general, when running Ansible on a local host to change AWS >>>> resources (rather than running a play on a remote host), you don't need to >>>> become a different user. So try just running the playbook on localhost as >>>> user "ansible" (assuming that you have AWS credentials set up for "ansible" >>>> of course. >>>> >>>> Alternatively, log in as root and set up AWS credentials in the root >>>> account on localhost. Not really a recommended approach. >>>> >>>> For most of my playbooks that work with AWS infrastructure, I run them >>>> as a user with suitable AWS credentials, and the playbooks start like this: >>>> >>>> --- >>>> - hosts: localhost >>>> connection: local >>>> gather_facts: false >>>> become: false >>>> >>>> Regards, K. >>>> >>>> >>>> On Sun, Aug 25, 2019 at 10:05 AM Amit Kulkarni <[email protected]> >>>> wrote: >>>> >>>>> Hello All, >>>>> >>>>> I tried to change the bucket name and ran my playbook, but its failing >>>>> with same error. >>>>> >>>>> I even specified the region as my EC2 instance but still its failing. >>>>> Below are my boto versions >>>>> boto3 (1.9.212) >>>>> botocore (1.12.215) >>>>> >>>>> Please suggest if i am doing something wrong here. I have also >>>>> attached s3 full access policy to my IAM user. >>>>> I am running this playbook as root user and my IAM user name is >>>>> ansible. >>>>> >>>>> root@ip-172-31-42-232:/etc/ansible# ansible-playbook s3.yml -vvv >>>>> ansible-playbook 2.8.3 >>>>> config file = /etc/ansible/ansible.cfg >>>>> configured module search path = [u'/root/.ansible/plugins/modules', >>>>> u'/usr/share/ansible/plugins/modules'] >>>>> ansible python module location = >>>>> /usr/lib/python2.7/dist-packages/ansible >>>>> executable location = /usr/bin/ansible-playbook >>>>> python version = 2.7.12 (default, Nov 12 2018, 14:36:49) [GCC 5.4.0 >>>>> 20160609] >>>>> Using /etc/ansible/ansible.cfg as config file >>>>> host_list declined parsing /etc/ansible/hosts as it did not pass it's >>>>> verify_file() method >>>>> script declined parsing /etc/ansible/hosts as it did not pass it's >>>>> verify_file() method >>>>> auto declined parsing /etc/ansible/hosts as it did not pass it's >>>>> verify_file() method >>>>> Parsed /etc/ansible/hosts inventory source with ini plugin >>>>> >>>>> PLAYBOOK: s3.yml >>>>> ******************************************************************************************************************************************************* >>>>> 1 plays in s3.yml >>>>> >>>>> PLAY [localhost] >>>>> ******************************************************************************************************************************************************* >>>>> >>>>> TASK [Gathering Facts] >>>>> ************************************************************************************************************************************************* >>>>> task path: /etc/ansible/s3.yml:2 >>>>> <127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: root >>>>> <127.0.0.1> EXEC /bin/sh -c 'echo ~root && sleep 0' >>>>> <127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo >>>>> /root/.ansible/tmp/ansible-tmp-1566690636.74-275478344374659 `" && echo >>>>> ansible-tmp-1566690636.74-275478344374659="` echo >>>>> /root/.ansible/tmp/ansible-tmp-1566690636.74-275478344374659 `" ) && sleep >>>>> 0' >>>>> Using module file >>>>> /usr/lib/python2.7/dist-packages/ansible/modules/system/setup.py >>>>> <127.0.0.1> PUT /root/.ansible/tmp/ansible-local-3920YJ0Dzu/tmppvx33n >>>>> TO >>>>> /root/.ansible/tmp/ansible-tmp-1566690636.74-275478344374659/AnsiballZ_setup.py >>>>> <127.0.0.1> EXEC /bin/sh -c 'chmod u+x >>>>> /root/.ansible/tmp/ansible-tmp-1566690636.74-275478344374659/ >>>>> /root/.ansible/tmp/ansible-tmp-1566690636.74-275478344374659/AnsiballZ_setup.py >>>>> && sleep 0' >>>>> <127.0.0.1> EXEC /bin/sh -c '/usr/bin/python >>>>> /root/.ansible/tmp/ansible-tmp-1566690636.74-275478344374659/AnsiballZ_setup.py >>>>> && sleep 0' >>>>> <127.0.0.1> EXEC /bin/sh -c 'rm -f -r >>>>> /root/.ansible/tmp/ansible-tmp-1566690636.74-275478344374659/ > /dev/null >>>>> 2>&1 && sleep 0' >>>>> ok: [localhost] >>>>> META: ran handlers >>>>> >>>>> TASK [Create an empty bucket] >>>>> ****************************************************************************************************************************************** >>>>> task path: /etc/ansible/s3.yml:4 >>>>> <127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: root >>>>> <127.0.0.1> EXEC /bin/sh -c 'echo ~root && sleep 0' >>>>> <127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo >>>>> /root/.ansible/tmp/ansible-tmp-1566690637.52-181677931604258 `" && echo >>>>> ansible-tmp-1566690637.52-181677931604258="` echo >>>>> /root/.ansible/tmp/ansible-tmp-1566690637.52-181677931604258 `" ) && sleep >>>>> 0' >>>>> Using module file >>>>> /usr/lib/python2.7/dist-packages/ansible/modules/cloud/amazon/aws_s3.py >>>>> <127.0.0.1> PUT /root/.ansible/tmp/ansible-local-3920YJ0Dzu/tmpICazr3 >>>>> TO >>>>> /root/.ansible/tmp/ansible-tmp-1566690637.52-181677931604258/AnsiballZ_aws_s3.py >>>>> <127.0.0.1> EXEC /bin/sh -c 'chmod u+x >>>>> /root/.ansible/tmp/ansible-tmp-1566690637.52-181677931604258/ >>>>> /root/.ansible/tmp/ansible-tmp-1566690637.52-181677931604258/AnsiballZ_aws_s3.py >>>>> && sleep 0' >>>>> <127.0.0.1> EXEC /bin/sh -c '/usr/bin/python >>>>> /root/.ansible/tmp/ansible-tmp-1566690637.52-181677931604258/AnsiballZ_aws_s3.py >>>>> && sleep 0' >>>>> <127.0.0.1> EXEC /bin/sh -c 'rm -f -r >>>>> /root/.ansible/tmp/ansible-tmp-1566690637.52-181677931604258/ > /dev/null >>>>> 2>&1 && sleep 0' >>>>> The full traceback is: >>>>> Traceback (most recent call last): >>>>> File "/tmp/ansible_aws_s3_payload_AzOF0F/__main__.py", line 384, in >>>>> bucket_check >>>>> s3.head_bucket(Bucket=bucket) >>>>> File "/root/.local/lib/python2.7/site-packages/botocore/client.py", >>>>> line 357, in _api_call >>>>> return self._make_api_call(operation_name, kwargs) >>>>> File "/root/.local/lib/python2.7/site-packages/botocore/client.py", >>>>> line 661, in _make_api_call >>>>> raise error_class(parsed_response, operation_name) >>>>> ClientError: An error occurred (403) when calling the HeadBucket >>>>> operation: Forbidden >>>>> >>>>> fatal: [localhost]: FAILED! => { >>>>> "boto3_version": "1.9.212", >>>>> "botocore_version": "1.12.215", >>>>> "changed": false, >>>>> "error": { >>>>> "code": "403", >>>>> "message": "Forbidden" >>>>> }, >>>>> "invocation": { >>>>> "module_args": { >>>>> "aws_access_key": "", >>>>> "aws_secret_key": "", >>>>> "bucket": "vinali", >>>>> "debug_botocore_endpoint_logs": false, >>>>> "dest": null, >>>>> "dualstack": false, >>>>> "ec2_url": null, >>>>> "encrypt": true, >>>>> "encryption_kms_key_id": null, >>>>> "encryption_mode": "AES256", >>>>> "expiry": 600, >>>>> "headers": null, >>>>> "ignore_nonexistent_bucket": false, >>>>> "marker": "", >>>>> "max_keys": 1000, >>>>> "metadata": null, >>>>> "mode": "create", >>>>> "object": null, >>>>> "overwrite": "always", >>>>> "permission": [ >>>>> "public-read" >>>>> ], >>>>> "prefix": "", >>>>> "profile": null, >>>>> "region": "us-east-2", >>>>> "retries": 0, >>>>> "rgw": false, >>>>> "s3_url": null, >>>>> "security_token": null, >>>>> "src": null, >>>>> "validate_certs": true, >>>>> "version": null >>>>> } >>>>> }, >>>>> "msg": "Failed while looking up bucket (during bucket_check) >>>>> vinali.: An error occurred (403) when calling the HeadBucket operation: >>>>> Forbidden", >>>>> "response_metadata": { >>>>> "host_id": >>>>> "HynfxcD919dq4ThF71VTbvEHK5lTdSLqJtDqrLf1SCSaJAWzg7K4CRB5qzOHQH5bGsPSpkM28rM=", >>>>> "http_headers": { >>>>> "content-type": "application/xml", >>>>> "date": "Sat, 24 Aug 2019 23:50:37 GMT", >>>>> "server": "AmazonS3", >>>>> "transfer-encoding": "chunked", >>>>> "x-amz-id-2": >>>>> "HynfxcD919dq4ThF71VTbvEHK5lTdSLqJtDqrLf1SCSaJAWzg7K4CRB5qzOHQH5bGsPSpkM28rM=", >>>>> "x-amz-request-id": "103457AA674E483D" >>>>> }, >>>>> "http_status_code": 403, >>>>> "request_id": "103457AA674E483D", >>>>> "retry_attempts": 0 >>>>> } >>>>> } >>>>> >>>>> PLAY RECAP >>>>> ************************************************************************************************************************************************************* >>>>> localhost : ok=1 changed=0 unreachable=0 >>>>> failed=1 skipped=0 rescued=0 ignored=0 >>>>> >>>>> Regards >>>>> Amit >>>>> >>>>> >>>>> >>>>> >>>>> On Sat, Aug 24, 2019 at 1:23 PM Karthik Chandrashekar < >>>>> [email protected]> wrote: >>>>> >>>>>> @amit, Can you try with different bucket name once. Remember AWS S3 >>>>>> bucket names must be unique. >>>>>> >>>>>> On Sat, 24 Aug, 2019, 10:45 PM Amit Kulkarni, <[email protected]> >>>>>> wrote: >>>>>> >>>>>>> Helllo All, >>>>>>> >>>>>>> I am able to overcome the credentials issue however now playbook is >>>>>>> failing with below issue. >>>>>>> >>>>>>> root@ip-172-31-42-232:/etc/ansible# ansible-playbook s3.yml -vvv >>>>>>> ansible-playbook 2.8.3 >>>>>>> config file = /etc/ansible/ansible.cfg >>>>>>> configured module search path = >>>>>>> [u'/root/.ansible/plugins/modules', >>>>>>> u'/usr/share/ansible/plugins/modules'] >>>>>>> ansible python module location = >>>>>>> /usr/lib/python2.7/dist-packages/ansible >>>>>>> executable location = /usr/bin/ansible-playbook >>>>>>> python version = 2.7.12 (default, Nov 12 2018, 14:36:49) [GCC >>>>>>> 5.4.0 20160609] >>>>>>> Using /etc/ansible/ansible.cfg as config file >>>>>>> host_list declined parsing /etc/ansible/hosts as it did not pass >>>>>>> it's verify_file() method >>>>>>> script declined parsing /etc/ansible/hosts as it did not pass it's >>>>>>> verify_file() method >>>>>>> auto declined parsing /etc/ansible/hosts as it did not pass it's >>>>>>> verify_file() method >>>>>>> Parsed /etc/ansible/hosts inventory source with ini plugin >>>>>>> >>>>>>> PLAYBOOK: s3.yml >>>>>>> ******************************************************************************************************************************************************* >>>>>>> 1 plays in s3.yml >>>>>>> >>>>>>> PLAY [localhost] >>>>>>> ******************************************************************************************************************************************************* >>>>>>> >>>>>>> TASK [Gathering Facts] >>>>>>> ************************************************************************************************************************************************* >>>>>>> task path: /etc/ansible/s3.yml:2 >>>>>>> <127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: root >>>>>>> <127.0.0.1> EXEC /bin/sh -c 'echo ~root && sleep 0' >>>>>>> <127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo >>>>>>> /root/.ansible/tmp/ansible-tmp-1566666456.61-207096775443244 `" && echo >>>>>>> ansible-tmp-1566666456.61-207096775443244="` echo >>>>>>> /root/.ansible/tmp/ansible-tmp-1566666456.61-207096775443244 `" ) && >>>>>>> sleep >>>>>>> 0' >>>>>>> Using module file >>>>>>> /usr/lib/python2.7/dist-packages/ansible/modules/system/setup.py >>>>>>> <127.0.0.1> PUT >>>>>>> /root/.ansible/tmp/ansible-local-2270DRSES3/tmpP8YUvk TO >>>>>>> /root/.ansible/tmp/ansible-tmp-1566666456.61-207096775443244/AnsiballZ_setup.py >>>>>>> <127.0.0.1> EXEC /bin/sh -c 'chmod u+x >>>>>>> /root/.ansible/tmp/ansible-tmp-1566666456.61-207096775443244/ >>>>>>> /root/.ansible/tmp/ansible-tmp-1566666456.61-207096775443244/AnsiballZ_setup.py >>>>>>> && sleep 0' >>>>>>> <127.0.0.1> EXEC /bin/sh -c '/usr/bin/python >>>>>>> /root/.ansible/tmp/ansible-tmp-1566666456.61-207096775443244/AnsiballZ_setup.py >>>>>>> && sleep 0' >>>>>>> <127.0.0.1> EXEC /bin/sh -c 'rm -f -r >>>>>>> /root/.ansible/tmp/ansible-tmp-1566666456.61-207096775443244/ > >>>>>>> /dev/null >>>>>>> 2>&1 && sleep 0' >>>>>>> ok: [localhost] >>>>>>> META: ran handlers >>>>>>> >>>>>>> TASK [Create an empty bucket] >>>>>>> ****************************************************************************************************************************************** >>>>>>> task path: /etc/ansible/s3.yml:4 >>>>>>> <127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: root >>>>>>> <127.0.0.1> EXEC /bin/sh -c 'echo ~root && sleep 0' >>>>>>> <127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo >>>>>>> /root/.ansible/tmp/ansible-tmp-1566666457.49-233501371669797 `" && echo >>>>>>> ansible-tmp-1566666457.49-233501371669797="` echo >>>>>>> /root/.ansible/tmp/ansible-tmp-1566666457.49-233501371669797 `" ) && >>>>>>> sleep >>>>>>> 0' >>>>>>> Using module file >>>>>>> /usr/lib/python2.7/dist-packages/ansible/modules/cloud/amazon/aws_s3.py >>>>>>> <127.0.0.1> PUT >>>>>>> /root/.ansible/tmp/ansible-local-2270DRSES3/tmpFtWTLO TO >>>>>>> /root/.ansible/tmp/ansible-tmp-1566666457.49-233501371669797/AnsiballZ_aws_s3.py >>>>>>> <127.0.0.1> EXEC /bin/sh -c 'chmod u+x >>>>>>> /root/.ansible/tmp/ansible-tmp-1566666457.49-233501371669797/ >>>>>>> /root/.ansible/tmp/ansible-tmp-1566666457.49-233501371669797/AnsiballZ_aws_s3.py >>>>>>> && sleep 0' >>>>>>> <127.0.0.1> EXEC /bin/sh -c '/usr/bin/python >>>>>>> /root/.ansible/tmp/ansible-tmp-1566666457.49-233501371669797/AnsiballZ_aws_s3.py >>>>>>> && sleep 0' >>>>>>> <127.0.0.1> EXEC /bin/sh -c 'rm -f -r >>>>>>> /root/.ansible/tmp/ansible-tmp-1566666457.49-233501371669797/ > >>>>>>> /dev/null >>>>>>> 2>&1 && sleep 0' >>>>>>> The full traceback is: >>>>>>> Traceback (most recent call last): >>>>>>> File "/tmp/ansible_aws_s3_payload_SEbdSf/__main__.py", line 384, >>>>>>> in bucket_check >>>>>>> s3.head_bucket(Bucket=bucket) >>>>>>> File "/usr/local/lib/python2.7/dist-packages/botocore/client.py", >>>>>>> line 357, in _api_call >>>>>>> return self._make_api_call(operation_name, kwargs) >>>>>>> File "/usr/local/lib/python2.7/dist-packages/botocore/client.py", >>>>>>> line 661, in _make_api_call >>>>>>> raise error_class(parsed_response, operation_name) >>>>>>> ClientError: An error occurred (403) when calling the HeadBucket >>>>>>> operation: Forbidden >>>>>>> >>>>>>> fatal: [localhost]: FAILED! => { >>>>>>> "boto3_version": "1.9.212", >>>>>>> "botocore_version": "1.12.212", >>>>>>> "changed": false, >>>>>>> "error": { >>>>>>> "code": "403", >>>>>>> "message": "Forbidden" >>>>>>> }, >>>>>>> "invocation": { >>>>>>> "module_args": { >>>>>>> "aws_access_key": "", >>>>>>> "aws_secret_key": "", >>>>>>> "bucket": "mybucket", >>>>>>> "debug_botocore_endpoint_logs": false, >>>>>>> "dest": null, >>>>>>> "dualstack": false, >>>>>>> "ec2_url": null, >>>>>>> "encrypt": true, >>>>>>> "encryption_kms_key_id": null, >>>>>>> "encryption_mode": "AES256", >>>>>>> "expiry": 600, >>>>>>> "headers": null, >>>>>>> "ignore_nonexistent_bucket": false, >>>>>>> "marker": "", >>>>>>> "max_keys": 1000, >>>>>>> "metadata": null, >>>>>>> "mode": "create", >>>>>>> "object": null, >>>>>>> "overwrite": "always", >>>>>>> "permission": [ >>>>>>> "public-read" >>>>>>> ], >>>>>>> "prefix": "", >>>>>>> "profile": null, >>>>>>> "region": "us-east-2", >>>>>>> "retries": 0, >>>>>>> "rgw": false, >>>>>>> "s3_url": null, >>>>>>> "security_token": null, >>>>>>> "src": null, >>>>>>> "validate_certs": true, >>>>>>> "version": null >>>>>>> } >>>>>>> }, >>>>>>> "msg": "Failed while looking up bucket (during bucket_check) >>>>>>> mybucket.: An error occurred (403) when calling the HeadBucket >>>>>>> operation: >>>>>>> Forbidden", >>>>>>> "response_metadata": { >>>>>>> "host_id": >>>>>>> "Y5EoHU94wSLzLN+iN7SDshJFmR78udMNnDpxUI13jVTTLVP5RQCS5oEYjmpB8o5JhejR8cuAB4w=", >>>>>>> "http_headers": { >>>>>>> "content-type": "application/xml", >>>>>>> "date": "Sat, 24 Aug 2019 17:07:37 GMT", >>>>>>> "server": "AmazonS3", >>>>>>> "transfer-encoding": "chunked", >>>>>>> "x-amz-bucket-region": "us-east-1", >>>>>>> "x-amz-id-2": >>>>>>> "Y5EoHU94wSLzLN+iN7SDshJFmR78udMNnDpxUI13jVTTLVP5RQCS5oEYjmpB8o5JhejR8cuAB4w=", >>>>>>> "x-amz-request-id": "73D609B218DBD779" >>>>>>> }, >>>>>>> "http_status_code": 403, >>>>>>> "request_id": "73D609B218DBD779", >>>>>>> "retry_attempts": 1 >>>>>>> } >>>>>>> } >>>>>>> >>>>>>> PLAY RECAP >>>>>>> ************************************************************************************************************************************************************* >>>>>>> localhost : ok=1 changed=0 unreachable=0 >>>>>>> failed=1 skipped=0 rescued=0 ignored=0 >>>>>>> >>>>>>> Below is the playbook i have written to create the bucket >>>>>>> >>>>>>> --- >>>>>>> - hosts: localhost >>>>>>> tasks: >>>>>>> - name: Create an empty bucket >>>>>>> aws_s3: >>>>>>> aws_access_key: "{{ lookup('env','aws_key') }}" >>>>>>> aws_secret_key: "{{ lookup('env','aws_secret') }}" >>>>>>> bucket: mybucket >>>>>>> mode: create >>>>>>> permission: public-read >>>>>>> region: us-east-2 >>>>>>> >>>>>>> Please let me know if someone has faced this issue. >>>>>>> >>>>>>> I have given IAM user, complete admin as well as S3 access. >>>>>>> >>>>>>> Regards >>>>>>> Amit >>>>>>> >>>>>>> >>>>>>> On Thu, Aug 22, 2019 at 8:27 PM Amit Kulkarni <[email protected]> >>>>>>> wrote: >>>>>>> >>>>>>>> Hi All, >>>>>>>> >>>>>>>> Need urgent help I am getting below error while creating S3 bucket >>>>>>>> using playbook. >>>>>>>> >>>>>>>> AWS keys I have set up as Environmental variables. >>>>>>>> >>>>>>>> Let me know if I am missing anything. >>>>>>>> >>>>>>>> Below is the playbbok >>>>>>>> >>>>>>>> --- >>>>>>>> - hosts: localhost >>>>>>>> tasks: >>>>>>>> - name: Create an empty bucket >>>>>>>> aws_s3: >>>>>>>> aws_access_key: "{{ lookup('env','aws_key') }}" >>>>>>>> aws_secret_key: "{{ lookup('env','aws_secret') }}" >>>>>>>> bucket: mybucket >>>>>>>> mode: create >>>>>>>> permission: public-read >>>>>>>> -------------------------------------------------------------- >>>>>>>> >>>>>>>> ubuntu@ip-172-31-42-232:/etc/ansible$ sudo ansible-playbook s3.yml >>>>>>>> -vvv >>>>>>>> ansible-playbook 2.8.3 >>>>>>>> config file = /etc/ansible/ansible.cfg >>>>>>>> configured module search path = >>>>>>>> [u'/home/ubuntu/.ansible/plugins/modules', >>>>>>>> u'/usr/share/ansible/plugins/modules'] >>>>>>>> ansible python module location = >>>>>>>> /usr/lib/python2.7/dist-packages/ansible >>>>>>>> executable location = /usr/bin/ansible-playbook >>>>>>>> python version = 2.7.12 (default, Nov 12 2018, 14:36:49) [GCC >>>>>>>> 5.4.0 20160609] >>>>>>>> Using /etc/ansible/ansible.cfg as config file >>>>>>>> host_list declined parsing /etc/ansible/hosts as it did not pass >>>>>>>> it's verify_file() method >>>>>>>> script declined parsing /etc/ansible/hosts as it did not pass it's >>>>>>>> verify_file() method >>>>>>>> auto declined parsing /etc/ansible/hosts as it did not pass it's >>>>>>>> verify_file() method >>>>>>>> Parsed /etc/ansible/hosts inventory source with ini plugin >>>>>>>> PLAYBOOK: s3.yml >>>>>>>> ******************************************************************************************************************************************************* >>>>>>>> 1 plays in s3.yml >>>>>>>> PLAY [localhost] >>>>>>>> ******************************************************************************************************************************************************* >>>>>>>> TASK [Gathering Facts] >>>>>>>> ************************************************************************************************************************************************* >>>>>>>> task path: /etc/ansible/s3.yml:2 >>>>>>>> <127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: root >>>>>>>> <127.0.0.1> EXEC /bin/sh -c 'echo ~root && sleep 0' >>>>>>>> <127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo >>>>>>>> /root/.ansible/tmp/ansible-tmp-1566352417.53-61320358842100 `" && echo >>>>>>>> ansible-tmp-1566352417.53-61320358842100="` echo >>>>>>>> /root/.ansible/tmp/ansible-tmp-1566352417.53-61320358842100 `" ) && >>>>>>>> sleep 0' >>>>>>>> Using module file >>>>>>>> /usr/lib/python2.7/dist-packages/ansible/modules/system/setup.py >>>>>>>> <127.0.0.1> PUT >>>>>>>> /home/ubuntu/.ansible/tmp/ansible-local-16195TKTGUm/tmpzD3QiP TO >>>>>>>> /root/.ansible/tmp/ansible-tmp-1566352417.53-61320358842100/AnsiballZ_setup.py >>>>>>>> <127.0.0.1> EXEC /bin/sh -c 'chmod u+x >>>>>>>> /root/.ansible/tmp/ansible-tmp-1566352417.53-61320358842100/ >>>>>>>> /root/.ansible/tmp/ansible-tmp-1566352417.53-61320358842100/AnsiballZ_setup.py >>>>>>>> && sleep 0' >>>>>>>> <127.0.0.1> EXEC /bin/sh -c '/usr/bin/python >>>>>>>> /root/.ansible/tmp/ansible-tmp-1566352417.53-61320358842100/AnsiballZ_setup.py >>>>>>>> && sleep 0' >>>>>>>> <127.0.0.1> EXEC /bin/sh -c 'rm -f -r >>>>>>>> /root/.ansible/tmp/ansible-tmp-1566352417.53-61320358842100/ > >>>>>>>> /dev/null >>>>>>>> 2>&1 && sleep 0' >>>>>>>> ok: [localhost] >>>>>>>> META: ran handlers >>>>>>>> TASK [Create an empty bucket] >>>>>>>> ****************************************************************************************************************************************** >>>>>>>> task path: /etc/ansible/s3.yml:4 >>>>>>>> <127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: root >>>>>>>> <127.0.0.1> EXEC /bin/sh -c 'echo ~root && sleep 0' >>>>>>>> <127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo >>>>>>>> /root/.ansible/tmp/ansible-tmp-1566352418.34-246931485115878 `" && echo >>>>>>>> ansible-tmp-1566352418.34-246931485115878="` echo >>>>>>>> /root/.ansible/tmp/ansible-tmp-1566352418.34-246931485115878 `" ) && >>>>>>>> sleep >>>>>>>> 0' >>>>>>>> Using module file >>>>>>>> /usr/lib/python2.7/dist-packages/ansible/modules/cloud/amazon/aws_s3.py >>>>>>>> <127.0.0.1> PUT >>>>>>>> /home/ubuntu/.ansible/tmp/ansible-local-16195TKTGUm/tmpleczvh TO >>>>>>>> /root/.ansible/tmp/ansible-tmp-1566352418.34-246931485115878/AnsiballZ_aws_s3.py >>>>>>>> <127.0.0.1> EXEC /bin/sh -c 'chmod u+x >>>>>>>> /root/.ansible/tmp/ansible-tmp-1566352418.34-246931485115878/ >>>>>>>> /root/.ansible/tmp/ansible-tmp-1566352418.34-246931485115878/AnsiballZ_aws_s3.py >>>>>>>> && sleep 0' >>>>>>>> <127.0.0.1> EXEC /bin/sh -c '/usr/bin/python >>>>>>>> /root/.ansible/tmp/ansible-tmp-1566352418.34-246931485115878/AnsiballZ_aws_s3.py >>>>>>>> && sleep 0' >>>>>>>> <127.0.0.1> EXEC /bin/sh -c 'rm -f -r >>>>>>>> /root/.ansible/tmp/ansible-tmp-1566352418.34-246931485115878/ > >>>>>>>> /dev/null >>>>>>>> 2>&1 && sleep 0' >>>>>>>> The full traceback is: >>>>>>>> Traceback (most recent call last): >>>>>>>> File "/tmp/ansible_aws_s3_payload_6bl3f1/__main__.py", line 384, >>>>>>>> in bucket_check >>>>>>>> s3.head_bucket(Bucket=bucket) >>>>>>>> File "/usr/local/lib/python2.7/dist-packages/botocore/client.py", >>>>>>>> line 357, in _api_call >>>>>>>> return self._make_api_call(operation_name, kwargs) >>>>>>>> File "/usr/local/lib/python2.7/dist-packages/botocore/client.py", >>>>>>>> line 648, in _make_api_call >>>>>>>> operation_model, request_dict, request_context) >>>>>>>> File "/usr/local/lib/python2.7/dist-packages/botocore/client.py", >>>>>>>> line 667, in _make_request >>>>>>>> return self._endpoint.make_request(operation_model, >>>>>>>> request_dict) >>>>>>>> File >>>>>>>> "/usr/local/lib/python2.7/dist-packages/botocore/endpoint.py", line >>>>>>>> 102, in >>>>>>>> make_request >>>>>>>> return self._send_request(request_dict, operation_model) >>>>>>>> File >>>>>>>> "/usr/local/lib/python2.7/dist-packages/botocore/endpoint.py", line >>>>>>>> 132, in >>>>>>>> _send_request >>>>>>>> request = self.create_request(request_dict, operation_model) >>>>>>>> File >>>>>>>> "/usr/local/lib/python2.7/dist-packages/botocore/endpoint.py", line >>>>>>>> 116, in >>>>>>>> create_request >>>>>>>> operation_name=operation_model.name) >>>>>>>> File "/usr/local/lib/python2.7/dist-packages/botocore/hooks.py", >>>>>>>> line 356, in emit >>>>>>>> return self._emitter.emit(aliased_event_name, **kwargs) >>>>>>>> File "/usr/local/lib/python2.7/dist-packages/botocore/hooks.py", >>>>>>>> line 228, in emit >>>>>>>> return self._emit(event_name, kwargs) >>>>>>>> File "/usr/local/lib/python2.7/dist-packages/botocore/hooks.py", >>>>>>>> line 211, in _emit >>>>>>>> response = handler(**kwargs) >>>>>>>> File >>>>>>>> "/usr/local/lib/python2.7/dist-packages/botocore/signers.py", line 90, >>>>>>>> in >>>>>>>> handler >>>>>>>> return self.sign(operation_name, request) >>>>>>>> File >>>>>>>> "/usr/local/lib/python2.7/dist-packages/botocore/signers.py", line >>>>>>>> 157, in >>>>>>>> sign >>>>>>>> auth.add_auth(request) >>>>>>>> File "/usr/local/lib/python2.7/dist-packages/botocore/auth.py", >>>>>>>> line 425, in add_auth >>>>>>>> super(S3SigV4Auth, self).add_auth(request) >>>>>>>> File "/usr/local/lib/python2.7/dist-packages/botocore/auth.py", >>>>>>>> line 357, in add_auth >>>>>>>> raise NoCredentialsError >>>>>>>> NoCredentialsError: Unable to locate credentials >>>>>>>> fatal: [localhost]: FAILED! => { >>>>>>>> "boto3_version": "1.9.212", >>>>>>>> "botocore_version": "1.12.212", >>>>>>>> "changed": false, >>>>>>>> "invocation": { >>>>>>>> "module_args": { >>>>>>>> "aws_access_key": "", >>>>>>>> "aws_secret_key": "", >>>>>>>> "bucket": "mybucket", >>>>>>>> "debug_botocore_endpoint_logs": false, >>>>>>>> "dest": null, >>>>>>>> "dualstack": false, >>>>>>>> "ec2_url": null, >>>>>>>> "encrypt": true, >>>>>>>> "encryption_kms_key_id": null, >>>>>>>> "encryption_mode": "AES256", >>>>>>>> "expiry": 600, >>>>>>>> "headers": null, >>>>>>>> "ignore_nonexistent_bucket": false, >>>>>>>> "marker": "", >>>>>>>> "max_keys": 1000, >>>>>>>> "metadata": null, >>>>>>>> "mode": "create", >>>>>>>> "object": null, >>>>>>>> "overwrite": "always", >>>>>>>> "permission": [ >>>>>>>> "public-read" >>>>>>>> ], >>>>>>>> "prefix": "", >>>>>>>> "profile": null, >>>>>>>> "region": null, >>>>>>>> "retries": 0, >>>>>>>> "rgw": false, >>>>>>>> "s3_url": null, >>>>>>>> "security_token": null, >>>>>>>> "src": null, >>>>>>>> "validate_certs": true, >>>>>>>> "version": null >>>>>>>> } >>>>>>>> }, >>>>>>>> "msg": "Failed while looking up bucket (during bucket_check) >>>>>>>> mybucket.: Unable to locate credentials" >>>>>>>> } >>>>>>>> PLAY RECAP >>>>>>>> ************************************************************************************************************************************************************* >>>>>>>> localhost : ok=1 changed=0 unreachable=0 >>>>>>>> failed=1 skipped=0 rescued=0 ignored=0 >>>>>>>> >>>>>>>> -- >>>>>>>> You received this message because you are subscribed to the Google >>>>>>>> Groups "Ansible Project" group. >>>>>>>> To unsubscribe from this group and stop receiving emails from it, >>>>>>>> send an email to [email protected]. >>>>>>>> To view this discussion on the web visit >>>>>>>> https://groups.google.com/d/msgid/ansible-project/6f4720f9-66bc-4af9-be2c-e677128488ba%40googlegroups.com >>>>>>>> <https://groups.google.com/d/msgid/ansible-project/6f4720f9-66bc-4af9-be2c-e677128488ba%40googlegroups.com?utm_medium=email&utm_source=footer> >>>>>>>> . >>>>>>>> >>>>>>> -- >>>>>>> You received this message because you are subscribed to the Google >>>>>>> Groups "Ansible Project" group. >>>>>>> To unsubscribe from this group and stop receiving emails from it, >>>>>>> send an email to [email protected]. >>>>>>> To view this discussion on the web visit >>>>>>> https://groups.google.com/d/msgid/ansible-project/CAON3ZR3dB3KGH%2BK8F88_w9s2fUzFbwtYfmouN5t%2BwJMRUA%2BU7w%40mail.gmail.com >>>>>>> <https://groups.google.com/d/msgid/ansible-project/CAON3ZR3dB3KGH%2BK8F88_w9s2fUzFbwtYfmouN5t%2BwJMRUA%2BU7w%40mail.gmail.com?utm_medium=email&utm_source=footer> >>>>>>> . >>>>>>> >>>>>> -- >>>>>> You received this message because you are subscribed to the Google >>>>>> Groups "Ansible Project" group. >>>>>> To unsubscribe from this group and stop receiving emails from it, >>>>>> send an email to [email protected]. >>>>>> To view this discussion on the web visit >>>>>> https://groups.google.com/d/msgid/ansible-project/CAD0rZAxieHf_cBSfUHEyAftMTqxpxoD4wpy%3DThJTXf1qQqsccA%40mail.gmail.com >>>>>> <https://groups.google.com/d/msgid/ansible-project/CAD0rZAxieHf_cBSfUHEyAftMTqxpxoD4wpy%3DThJTXf1qQqsccA%40mail.gmail.com?utm_medium=email&utm_source=footer> >>>>>> . >>>>>> >>>>> -- >>>>> You received this message because you are subscribed to the Google >>>>> Groups "Ansible Project" group. >>>>> To unsubscribe from this group and stop receiving emails from it, send >>>>> an email to [email protected]. >>>>> To view this discussion on the web visit >>>>> https://groups.google.com/d/msgid/ansible-project/CAON3ZR2Umumc3Vib3ynosNMa%3DpfSCSPkWwTR-QMB-O4mPXJXyQ%40mail.gmail.com >>>>> <https://groups.google.com/d/msgid/ansible-project/CAON3ZR2Umumc3Vib3ynosNMa%3DpfSCSPkWwTR-QMB-O4mPXJXyQ%40mail.gmail.com?utm_medium=email&utm_source=footer> >>>>> . >>>>> >>>> >>>> >>>> -- >>>> Karl Auer >>>> >>>> Email : [email protected] >>>> Website: http://2pisoftware.com >>>> >>>> GPG/PGP : 301B 1F4E 624D AD99 242C 7A68 EC24 7113 E854 4A4E >>>> Previous: 958A 2647 6C44 D376 3D63 86A5 FFB2 20BC 0257 5816 >>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "Ansible Project" group. >>>> To unsubscribe from this group and stop receiving emails from it, send >>>> an email to [email protected]. >>>> To view this discussion on the web visit >>>> https://groups.google.com/d/msgid/ansible-project/CA%2B%2BT08S%3DrxW7a_wZco50UcoV%3DkKM8b0anijjm-zTR_fMvjfeMA%40mail.gmail.com >>>> <https://groups.google.com/d/msgid/ansible-project/CA%2B%2BT08S%3DrxW7a_wZco50UcoV%3DkKM8b0anijjm-zTR_fMvjfeMA%40mail.gmail.com?utm_medium=email&utm_source=footer> >>>> . >>>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Ansible Project" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/ansible-project/CAON3ZR0wdbEfOsRGBcgNMpLTZxy8Na5dQvUMAWjcdfDTBUs9Rg%40mail.gmail.com >>> <https://groups.google.com/d/msgid/ansible-project/CAON3ZR0wdbEfOsRGBcgNMpLTZxy8Na5dQvUMAWjcdfDTBUs9Rg%40mail.gmail.com?utm_medium=email&utm_source=footer> >>> . >>> >> >> >> -- >> Karl Auer >> >> Email : [email protected] >> Website: http://2pisoftware.com >> >> GPG/PGP : 301B 1F4E 624D AD99 242C 7A68 EC24 7113 E854 4A4E >> Previous: 958A 2647 6C44 D376 3D63 86A5 FFB2 20BC 0257 5816 >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Ansible Project" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/ansible-project/CA%2B%2BT08Q15aoOK%3DWx-uDFr81YrVbSL_12nyAS2dBbQ0NshhmwbQ%40mail.gmail.com >> <https://groups.google.com/d/msgid/ansible-project/CA%2B%2BT08Q15aoOK%3DWx-uDFr81YrVbSL_12nyAS2dBbQ0NshhmwbQ%40mail.gmail.com?utm_medium=email&utm_source=footer> >> . >> > -- > You received this message because you are subscribed to the Google Groups > "Ansible Project" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/CAON3ZR1KZLfmK6CanPToZL2_Oh59Q%2Bei%2BE5vGYAOKUXv28U-Nw%40mail.gmail.com > <https://groups.google.com/d/msgid/ansible-project/CAON3ZR1KZLfmK6CanPToZL2_Oh59Q%2Bei%2BE5vGYAOKUXv28U-Nw%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- Karl Auer Email : [email protected] Website: http://2pisoftware.com GPG/PGP : 301B 1F4E 624D AD99 242C 7A68 EC24 7113 E854 4A4E Previous: 958A 2647 6C44 D376 3D63 86A5 FFB2 20BC 0257 5816 -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CA%2B%2BT08RNyVmu%3D_xZwsuLwUbERXoxfmfCcb-WMMhWjuXa4GG%3DcA%40mail.gmail.com.
