role_dnsmasq/templates/ansible_inventory.conf.j2

16 lines
426 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 %}
{% for ip in dnsmasq_host_ips %}
{{ ip }} {{ hostnames | select() | join(' ') }}
{% endfor %}
{% if host != last_host %}
{% endif %}
{% endfor %}