Easier way to select host group value

Assuming this is a template, if you need more than 5, normally this would be accessed in a loop like so:

{% for x in groups[‘JournalNodes’] %}
{{ hostvars[…] }}
{% end for %}

You can also use {% set % } to define variables and make things shorter in templates

Let me know if I’m misunderstanding the use case.

You should be able to use python slicing in the loop (haven’t tried!) to get the first 5 nodes like:

{% for x in groups[‘JournalNodes’][0:4] %}