On 08/02/2023 09:21, Norbert Klamann wrote:
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 ``` {% forgroupingroupsifgroup!='ungrouped'%} {% forhostingroups[group]%} {% ifloop.first%}{% sethvh=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.
Hello Norbert, can you give an example of the desired output? Regards Racke
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 <https://groups.google.com/d/msgid/ansible-project/fadc4912-aaab-4cfa-aa18-22dd5fe1d12dn%40googlegroups.com?utm_medium=email&utm_source=footer>.
-- Automation expert - Ansible and friends Linux administrator & Debian maintainer Perl Dancer & conference hopper -- 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/337d16dc-9472-b46c-8bf1-08565fff84cd%40linuxia.de.
