I need to workaround a bug in "virt_net" module when more then a network is 
created. 

For this the task uses the iterates explicitly through all hosts of the 
group instead of performing the task in the context of the 
*inventory_hostname*:

- name: "gather neccessary libvirt networks"
  set_fact: virt_networks="{{ virt_networks | default({}) | 
combine({hostvars[item].cidr:hostvars[item].network}) }}"
  with_items:
        "{{ libvirt.nodes }}"

libvirt.group is extra defined in the main variable section of my playbook 
and references manually the hosts group. 

variables:
    - libvirt:
        nodes: "{{ groups['ovirtm'] }}"

Can I get the list of all nodes of my hostgroup without extra defining it 
in the vars section?

Only found that something like this works, but this may not return the 
correct group...

ansible -m debug -a msg="{{ 
groups[hostvars[inventory_hostname].group_names[0]] }}"


-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/082b141d-d3b5-44f9-9ee3-4630349d391e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to