On 08/02/2023 09:58, Norbert Klamann wrote:
Yes of course , it should look  like this
```
all                   - "alle interessierenden Hosts, auch nicht per ansible 
kontrollierbare"
controllable          - Alle Hosts, die mit ansible kontrolliert werden koennten
fm174                 - Alle Hosts in FM 174 (soweit Ansible-fähig)
hetzner               - Alle Hosts bei Hetzner (cloud)
virtual_ansible_hosts - Nicht per Ansible erreichbare Maschinen, aber sie 
sollen durch (Meta-) Variablen doukmentiert werden
virtual_FM174         - Virtuelle Ansible Hosts in FM174

```

Hello Norbert,

take a look at the Jinja sort filter: 
https://jinja.palletsprojects.com/en/3.0.x/templates/#jinja-filters.sort

Regards

        Racke

[email protected] schrieb am Mittwoch, 8. Februar 2023 um 09:47:53 UTC+1:

    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
 
<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/74860064-0aef-4a92-acb3-4ff9cdfd0efcn%40googlegroups.com
 
<https://groups.google.com/d/msgid/ansible-project/74860064-0aef-4a92-acb3-4ff9cdfd0efcn%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/f197ff9a-b4f1-eb55-c7ab-61b65fbb39c3%40linuxia.de.

Reply via email to