Created
June 30, 2017 12:05
-
-
Save 11mariom/a098ff6194b10ae2aec811e6551646a2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: Vars iteration | |
hosts: all | |
vars: | |
users: | |
user1: | |
name: user1 | |
key: ssh-key | |
user2: | |
name: user2 | |
key: ssh-key2 | |
user: | |
- user1 | |
tasks: | |
- name: Iterate user | |
debug: | |
msg: "{{ item }}" | |
with_items: | |
- user | |
- name: Iterate users | |
debug: | |
msg: "{{ item.value.name }}" | |
with_dict: "{{ users }}" | |
- name: Iterate user over users | |
debug: | |
msg: "{{ item.value.name }} - {{ item.value.key }}" | |
with_dict: "{{ users }}" | |
when: item.key in user |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment