role_dnsmasq/templates/ansible_inventory.conf.j2

16 lines
462 B
Plaintext
Raw Normal View History

2023-09-22 15:25:03 +00:00
# {{ 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']] + hostvars[host]['dnsmasq_host_aliases'] %}
{% for ip in hostvars[host]['dnsmasq_host_ips'] %}
{{ ip }} {{ hostnames | select() | join(' ') }}
{% endfor %}
{% if host != last_host %}
{% endif %}
{% endfor %}