Hi Michael, This simple example might help you that how we can use the 
with_items with dictionary:

---
- hosts: all
  become: no
  gather_facts: no
  connection: local
  vars:
    USERS:
      foo:
        state: present
        company: 'Bar foo'
        email: [email protected]
        uid: 6001
        groups:
          - ring-admins
          - ring-users
      
      bar:
        state: present
        company: 'Foo bar'
        email: [email protected]       
        uid: 6002
        groups:
          - ring-admins
          - ring-users


  tasks:
    - debug:
        msg: "{{ item }} , {{ USERS[item].state }} , {{ USERS[item].company 
}}, {{ USERS[item].email }}, {{ USERS[item].uid }} , {{ 
USERS[item].groups|join( ',' ) }}"
      with_items: "{{ USERS | list }}"


Result of the playbook:

╰─➤  ansible-playbook -i localhost, playbook.yml

PLAY [all] 
*******************************************************************************************************************

TASK [debug] 
*****************************************************************************************************************
ok: [localhost] => (item=foo) => {
    "item": "foo",
    "msg": "foo , present , Bar foo, [email protected], 6001 , 
ring-admins,ring-users"
}
ok: [localhost] => (item=bar) => {
    "item": "bar",
    "msg": "bar , present , Foo bar, [email protected], 6002 , 
ring-admins,ring-users"
}

PLAY RECAP 
*******************************************************************************************************************
localhost                  : ok=1    changed=0    unreachable=0    failed=0


Hope that might help you.

On Tuesday, August 29, 2017 at 12:51:19 AM UTC+5, Michael Bushey wrote:
>
> Hello,
>
> I have a dict that contains a list of sites. For each of these sites I 
> would like to provide a list of symlinks to create provided by with_items. 
> Is this possible? I have Ansible 2.3.1.0.
>
>
> Thanks!
> Michael
>

-- 
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/34222ac7-feed-4cc1-979c-03bbda79eb2f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to