I ended up restructuring my vars a bit:
- name: archive logs
  hosts: localhost
  vars:
    - date: "{{ lookup('pipe', 'date -d \"-1 month\" +\"%m-%Y\"') }}"
    - customers:
      - { name: 'customer1', archive: 'customer1.tgz', bucket: 
'customer1-log-archive' }
      - { name: 'customer2', archive: 'customer2.tgz', bucket: 
'customer2-log-archive' }


Then I just need to add with_items: "{{ customers }}" to the end of each 
task to get the loop that I wanted. 

Thanks for the help.

On Tuesday, November 13, 2018 at 9:18:50 AM UTC-6, Brian Coca wrote:
>
> Create an inventory in which the 'hosts' are customers and associate 
> the variables to each host, then have the play run `hosts: customer` 
> and `delegate_to: localhost`/ 
>
> -- 
> ---------- 
> Brian Coca 
>

-- 
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/b874e363-9be3-4c23-a77b-9e5646a2273b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to