Is it possible to do something like this:
# inventories/inventory1/group_vars/group1
filewatches:
{% for host in groups['group2'] %}
- type: "copy"
directory_name: "{{ host }}"
shell_script: "{{ script_dir }}/ascript.sh"
{endfor %}
- type: "anotherone"
...
# inventories/inventory1/hosts
[group1]
somemachine01
[group2]
machine1
machine2
machine3
...
Basically, I want to generate a bunch configuration that is similar except for just one variable (in this case the directory_name variable). I would rather do this than making 20+ different entries which all differ by JUST the directory_name variable.
I did not include the playbook or roles information for the sake of clarity/terseness. I hope I was clear enough and gave enough context, and I appreciate any help.
Thanks!