I recently got around to uninstalling the old MS ansible extension and installing the new one. First thing I noticed is the syntax highlighting seems weaker. I’ve had all sorts of ansible and yaml extensions installed, so I’m not sure if it’s me and my config or features yet to be implemented.
group_vars.yml
G1:
- groupname: A
G2:
- groupname: B
G3:
- groupname: C
G4:
- groupname: D
... pass just the G1 and G2 as extra_vars to "groups_name" from the command line.
- include_vars: group_vars.yml
- name: Create Group(s)
group:
name: "{{ item.groupname }}"
state: present
with_items:
- "{{groups_name}}"
Put the data into dictionaries, e.g.
> cat group_vars.yml
G1:
groupname: A
G2:
groupname: B
G3:
groupname: C
G4:
groupname: D
Include the variables into a dictionary and extract the keys, e.g.