role_dnsmasq/templates/ansible_inventory.conf.j2

14 lines
380 B
Django/Jinja

# {{ ansible_managed }}
{% for ip in dnsmasq_host_ips %}
{% endfor %}
{% set last_host = groups['all'] | last %}
{% for host in groups['all'] %}
{% set hostnames = [hostvars[host]['inventory_hostname']] + [hostvars[host]['inventory_hostname_short']] + dnsmasq_host_aliases %}
{{ ip }} {{ hostnames | select() | join(' ') }}
{% if host != last_host %}
{% endif %}
{% endfor %}