Hi. Im trying to automate our restore machine testing. 
At one point i need to connect to amason S3 and download the latest data 
from a bucket. 

s3://bucet.name/application_name/DATE/version/files1-3

What i have tried thus far:


- name: List s3 objects
      aws_s3:
        bucket: "bucket.name"
        prefix: "/application_name/"
        dest: /home/user/tmp-file
        mode: list
        max_keys: 5
      register: s3objects
      become: yes
      become_user: user    
    
    - name: show list?
      debug:
        msg: "heres the list: {{ s3objects.s3_keys }}"
    
    
    
    - name: write to file
      copy:
        content: "{{ s3objects }}"
        dest: /home/user/tmp-file
      with_items: s3objects.s3_keys  
      become: yes
      become_user: user

The tmp file has this info: 
"{"msg": "LIST operation complete", "failed": false, "changed": false, 
"s3_keys": []}"

Im very new to ansible, what i would ultimately want is to get this: 
aws s3 ls s3://bucet.name/application_name/ | tail -5

-- 
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/d54069b6-9f94-4fe4-ae1d-825292f152f5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to