Hello all,
i use Ansible to document and manage a small network of computers and other 
devices. So I bulit an inventory with several groups and hosts and defined 
a bunch of variables  on each level to describe what i want to achieve,  
Each host and each group has for example a variable named `host_comment` or 
`group_comment` respectively.

This is very useful on the host level, but i want to show the group 
variables separately in a loop over all groups.

I can show a group variable via `hostvars[host].group_comment`but because 
every hosts belongs to several groups i cannot control, whicht name is 
displayed.

This template
```
{% for group in groups  if  group != 'ungrouped' %}
  {% for host in groups[group] %}
  {% if loop.first %}{% set hvh = hostvars[host] %}
  {{ group }}     {{ hvh.group_comment }}
  {% endif %}
  {% endfor %}
{% endfor %}
```

gives 
```
  all     Nicht per Ansible erreichbare Maschinen, aber sie sollen durch 
(Meta-) Variablen doukmentiert werden
  lxc_container     Alle Hosts in FM 174 (soweit Ansible-fähig)
  fm174     Alle Hosts in FM 174 (soweit Ansible-fähig)
  hetzner     Alle Hosts bei Hetzner (cloud)
  controllable     Alle Hosts in FM 174 (soweit Ansible-fähig)
  virtual_FM174     Virtuelle Ansible Hosts in FM174
  virtual_ansible_hosts     Nicht per Ansible erreichbare Maschinen, aber 
sie sollen durch (Meta-) Variablen doukmentiert werden

```
I think it is visible that this result makes no sense.

Can anyone help here ?

Thanks a lot !

Norbert


-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/fadc4912-aaab-4cfa-aa18-22dd5fe1d12dn%40googlegroups.com.

Reply via email to