# s3 module can create a bucket, but cannot list bucket contents

**URL:** <https://forum.ansible.com/t/s3-module-can-create-a-bucket-but-cannot-list-bucket-contents/24778>\
**Category:** Ansible Project\
**Tags:** aws\
**Created:** [June 21, 2017, 12:44am UTC](https://forum.ansible.com/t/s3-module-can-create-a-bucket-but-cannot-list-bucket-contents/24778 "2017-06-21T00:44:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael\_Bushey](https://avatars.discourse-cdn.com/v4/letter/m/e9bcb4/32.png) [@Michael\_Bushey](https://forum.ansible.com/u/Michael_Bushey)\
**Post date:** [June 21, 2017, 12:44am UTC](https://forum.ansible.com/t/s3-module-can-create-a-bucket-but-cannot-list-bucket-contents/24778/1 "2017-06-21T00:44:33Z")

</div>

I’m unable to get a list of an s3 bucket, Ansible says OK but no data is retrieved.

╰─➤ dpkg -l | grep boto  
ii python-boto 2.40.0-1ubuntu1 all Python interface to Amazon’s Web Services - Python 2.x  
ii python-boto3 1.4.2-1 all Python interface to Amazon’s Web Services - Python 2.x  
ii python-botocore 1.5.7-1 all Low-level, data-driven core of boto 3 (Python 2)

╰─➤ ansible --version  
ansible 2.3.1.0  
config file = /etc/ansible/ansible.cfg  
configured module search path = Default w/o overrides  
python version = 2.7.12 (default, Nov 19 2016, 06:48:10) [GCC 5.4.0 20160609]

- name: AWS Bucket get last SQL dunp  
hosts: localhost  
gather\_facts: no  
connection: local  
vars:  
bucket: myuniquebucketname  
tasks:

- name: AWS get bucket list  
s3:  
bucket: “{{ bucket }}”  
mode: list  
register: mysqldump\_list  
tags: aws, bucket

- debug: var=“{{ mysqldump\_list }}”

╰─➤ ansible-playbook -i /etc/ansible/ec2.py aws\_bucket\_mysqltest\_getlast.yml

PLAY [AWS Bucket get last SQL dunp] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\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*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
ok: [localhost] =\> {  
“\<type ‘dict’\>”: “VARIABLE IS NOT DEFINED!”  
}

PLAY RECAP \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
localhost : ok=2 changed=0 unreachable=0 failed=0

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [June 21, 2017, 12:36pm UTC](https://forum.ansible.com/t/s3-module-can-create-a-bucket-but-cannot-list-bucket-contents/24778/2 "2017-06-21T12:36:35Z")

</div>

Wrong syntax.

var= take name of the variable not the content.

- debug: var=mysqldump\_list

---

<div class="post-metadata">

**Author:** ![Michael\_Bushey](https://avatars.discourse-cdn.com/v4/letter/m/e9bcb4/32.png) [@Michael\_Bushey](https://forum.ansible.com/u/Michael_Bushey)\
**Post date:** [June 21, 2017, 5:01pm UTC](https://forum.ansible.com/t/s3-module-can-create-a-bucket-but-cannot-list-bucket-contents/24778/3 "2017-06-21T17:01:43Z")

</div>

Thank you Kai, that is exactly what I was doing wrong. Have a great day!
