Suppose I have the following playbook:
---
- hosts: all
gather_facts: False
vars:
group: 'dev'
tasks:
- name: Just loop through a group and group_vars
debug:
msg: 'group is {{group}} target is {{item.0}} port is {{item.1}}'
loop: >
{{ groups[group] |
product(hostvars[groups[group][0]]["ports"]) |
list }}
How can I change the loop part in case I have the variable named "group" defined as list and not as a single variable? For example:
vars:
group:
- 'dev'
- 'int'
Thanks and regards.
Stef