Hi guys, suppose i have this task like the one below, where i want all servers from the haproxy group to access a specific mysql database
Hi guys, suppose i have this task like the one below, where i want all servers from the haproxy group to access a specific mysql database
I think I read that joining two lists (thats what they are) is done
using a plus sign:
with_items: groups['haproxy'] + groups['foobar']
In your case you do not have a second list foobar, you want to iterate
over the first list but get another item, not the name that is in the
inventory (ansible_hostname) but something else. I do not know if that
is possible.
Johannes
I don't think you can do this in one task since host: need to have to different values.
So split in two tasks, one with
host: "{{ item }}"
with_items: groups['haproxy']
and the second with
host: "{{ hostvars[item]['ansible_fqdn'] }}"
with_items: groups['haproxy']