Hello All,

I am trying to use ansible to read values from a csv file (source and 
destination) and then run commands using the shell module, but I am having 
no success. Please assist .

The playbook:
---
  - name: Read Users
    gather_facts: True
    hosts: localhost

    tasks:
    - name: Read users
      read_csv:
        path: users.csv
        delimiter: ","
      register: s3list

    - name: Running command
      command: 
echo "aws s3 cp {{ s3.source }}" {{ s3.destination }} -- recursive 
--acl-parameters ---profile prod'
      loop: "{{ s3list.list }}"
      loop_control:
        loop_var: s3



the csv file contents:
source,destination
S3://mybucket/puppy/test.jpg,S3://mybucket2/trying/
S3://mybucket/puppy/ds.jpg,S3://mybucket3/trying/
S3://mybucket/puppy/as.jpg,S3://mybucket4/trying/
S3://mybucket/puppy/was.jpg,S3://mybucket5/trying/
S3://mybucket/puppy/qaes.jpg,S3://mybucket6/trying/

When I run the playbook I am getting the following
TASK [Running command] 
*********************************************************************************************************************
changed: [localhost] => (item={'source': 'S3://mybucket/puppy/test.jpg', 
'destination': 'S3://mybucket2/trying/'})
changed: [localhost] => (item={'source': 'S3://mybucket/puppy/ds.jpg', 
'destination': 'S3://mybucket3/trying/'})
changed: [localhost] => (item={'source': 'S3://mybucket/puppy/as.jpg', 
'destination': 'S3://mybucket4/trying/'})
changed: [localhost] => (item={'source': 'S3://mybucket/puppy/was.jpg', 
'destination': 'S3://mybucket5/trying/'})
changed: [localhost] => (item={'source': 'S3://mybucket/puppy/qaes.jpg', 
'destination': 'S3://mybucket6/trying/'})

PLAY RECAP 
*********************************************************************************************************************************
localhost                  : ok=3    changed=1    unreachable=0    failed=0 
   skipped=0    rescued=0    ignored=0   


I would like to run the aws command, but it doesnt seem to work 

-- 
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/7065cec3-756f-4fe0-934c-a9046348c5f2n%40googlegroups.com.

Reply via email to