feat: Add new variable for ipv6 subnet
This commit is contained in:
parent
180fe1c26a
commit
ed9eb28dfb
@ -18,5 +18,8 @@ dnsmasq_client_hostname: "{{ inventory_hostname }} {{ inventory_hostname_short }
|
|||||||
# Groupe ansible pour l'enregistrement automatique
|
# Groupe ansible pour l'enregistrement automatique
|
||||||
dnsmasq_ansible_group: zone_gaia
|
dnsmasq_ansible_group: zone_gaia
|
||||||
|
|
||||||
|
# CIDR du sous-réseau IPv6
|
||||||
|
dnsmasq_ipv6_subnet: ""
|
||||||
|
|
||||||
# Enregistrement spécifiques
|
# Enregistrement spécifiques
|
||||||
dnsmasq_specifics: []
|
dnsmasq_specifics: []
|
||||||
|
@ -3,15 +3,10 @@
|
|||||||
{% for host in groups[dnsmasq_ansible_group] %}
|
{% for host in groups[dnsmasq_ansible_group] %}
|
||||||
{%- set ipv4 = hostvars[host]['ansible_host'] %}
|
{%- set ipv4 = hostvars[host]['ansible_host'] %}
|
||||||
{%- set ipv6_suffix = hostvars[host]['ansible_host'] | split('.') | last %}
|
{%- set ipv6_suffix = hostvars[host]['ansible_host'] | split('.') | last %}
|
||||||
|
{%- set ipv6 = (dnsmasq_ipv6_subnet | split('/') | first) + ipv6_suffix %}
|
||||||
{%- set aliases = [host] + hostvars[host].get('dnsmasq_host_aliases', []) %}
|
{%- set aliases = [host] + hostvars[host].get('dnsmasq_host_aliases', []) %}
|
||||||
|
|
||||||
# {{ host }}
|
# {{ host }}
|
||||||
{{ ipv4 }} {{ aliases | join(' ') }}
|
{{ ipv4 }} {{ aliases | join(' ') }}
|
||||||
{% if (ipv6_suffix | int) < 10 %}
|
{{ ipv6 }} {{ aliases | join(' ') }}
|
||||||
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 %}
|
{% endfor %}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user