Hi,

This code works, I just don't understand the indexing and loop behaviour. 
Hoping someone can help me understand the indexing, and why the variables 
are equal to the values.

Here the code:

```
engineers:
  - username: user1
    state: present
    keys:
      - ssh-rsa AAAAB3Nza....
      - ssh-rsa AAAAB3Nza....
  - username: user2
    state: present
    keys:
      - ssh-rsa AAAAB3NzaC....
  - username: user3
    state: present
    keys: 
      - ssh-rsa AAAAB3NzaC1....
```

and I have a working code snippet:
```
- name: Manage authorized keys
  authorized_key:
    user: "{{ item.0.username }}"
    state: present
    key: "{{ item.1 }}"
  with_subelements:
    - "{{ engineers }}"
    - keys
  loop_control:
    loop_var: item
```


-- 
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/afb18fd6-c249-4226-8f1d-f4a596fe1367n%40googlegroups.com.

Reply via email to