You've already forked role_dnsmasq
feat: Use automatic inventory
This commit is contained in:
17
templates/auto.conf.j2
Normal file
17
templates/auto.conf.j2
Normal file
@@ -0,0 +1,17 @@
|
||||
# {{ ansible_managed }}
|
||||
|
||||
{% for host in groups[dnsmasq_ansible_group] %}
|
||||
{%- set ipv4 = hostvars[host]['ansible_host'] %}
|
||||
{%- set ipv6_suffix = hostvars[host]['ansible_host'] | split('.') | last %}
|
||||
{%- set aliases = [host] + hostvars[host].get('dnsmasq_host_aliases', []) %}
|
||||
|
||||
# {{ host }}
|
||||
{{ ipv4 }} {{ aliases | join(' ') }}
|
||||
{% if (ipv6_suffix | int) < 10 %}
|
||||
2a01:e0a:ee5:8b0::d00{{ ipv6_suffix }} {{ aliases | join(' ') }}
|
||||
{% elif (ipv6_suffix | int) < 100 %}
|
||||
2a01:e0a:ee5:8b0::d0{{ ipv6_suffix }} {{ aliases | join(' ') }}
|
||||
{% else %}
|
||||
2a01:e0a:ee5:8b0::d{{ ipv6_suffix }} {{ aliases | join(' ') }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
@@ -1,6 +1,17 @@
|
||||
# {{ ansible_managed }}
|
||||
|
||||
{% for ip in item.ips %}
|
||||
{% set aliases = item.get('aliases', []) %}
|
||||
{{ ip }} {{ ([item.hostname] + aliases) | join(' ') }}
|
||||
{% for host in groups['zone_gaia'] %}
|
||||
{%- set ipv4 = hostvars[host]['ansible_host'] %}
|
||||
{%- set ipv6_suffix = hostvars[host]['ansible_host'] | split('.') | last %}
|
||||
{%- set aliases = [host] + hostvars[host].get('dnsmasq_host_aliases', []) %}
|
||||
|
||||
# {{ host }}
|
||||
{{ ipv4 }} {{ aliases | join(' ') }}
|
||||
{% if (ipv6_suffix | int) < 10 %}
|
||||
2a01:e0a:ee5:8b0::d00{{ ipv6_suffix }} {{ aliases | join(' ') }}
|
||||
{% elif (ipv6_suffix | int) < 100 %}
|
||||
2a01:e0a:ee5:8b0::d0{{ ipv6_suffix }} {{ aliases | join(' ') }}
|
||||
{% else %}
|
||||
2a01:e0a:ee5:8b0::d{{ ipv6_suffix }} {{ aliases | join(' ') }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
7
templates/specific.conf.j2.disabled
Normal file
7
templates/specific.conf.j2.disabled
Normal file
@@ -0,0 +1,7 @@
|
||||
# {{ ansible_managed }}
|
||||
|
||||
{% for host in group['zone_gaia'] %}
|
||||
# {{ inventory_hostname }}
|
||||
192.168.84.{{ proxmox_host_id }} {{ inventory_hostname }} {{ inventory_hostname_short }} {{ dnsmasq_host_aliases | join(' ') }}
|
||||
2a01:cb00:131:f100::d0{{ proxmox_host_id }} {{ inventory_hostname }} {{ inventory_hostname_short }} {{ dnsmasq_host_aliases | join(' ') }}
|
||||
{% endfor %}
|
Reference in New Issue
Block a user