[interfaces] Configure adh interface

certbot_on_virtu
_benjamin 2020-04-21 13:24:34 +02:00 committed by Bombar Maxime
parent 8631a875e3
commit 5d5a6f0b5c
2 changed files with 45 additions and 0 deletions

View File

@ -32,3 +32,10 @@
dest: /etc/network/interfaces.d/21-fil
mode: 0644
when: fil_iface.stdout
- name: Deploy adh interface config
template:
src: network/interfaces.d/23-adh.j2
dest: /etc/network/interfaces.d/23-adh
mode: 0644
when: adh_iface.stdout

View File

@ -0,0 +1,38 @@
{{ ansible_header | comment }}
{% set adh = hostvars[inventory_hostname]['ansible_' + adh_iface.stdout] %}
allow-hotplug {{ adh_iface.stdout }}
iface {{ adh_iface.stdout }} inet static
address {{ adh.ipv4.address }}
network {{ adh.ipv4.network }}
netmask {{ adh.ipv4.netmask }}
broadcast {{ adh.ipv4.broadcast }}
gateway {{ adh_gateway }}
mtu 1496
dns-nameservers {{ adh_dns }}
dns-search crans.org
up /sbin/ip link set $IFACE alias adh
{% if 'interfaces' in ansible_local %}
{% if 'sup_if_4' in ansible_local.interfaces %}
{% if adh_iface.stdout in ansible_local.interfaces.sup_if_4 %}
{% for line in ansible_local.interfaces.sup_if_4[adh_iface.stdout] %}
{{ line }}
{% endfor %}
{% endif %}
{% endif %}
{% endif %}
iface {{ adh_iface.stdout }} inet6 static
address {{ adh.ipv6[0].address }}/{{ adh.ipv6[0].prefix }}
autoconf 1
accept_ra 2
up /sbin/sysctl net/ipv6/conf/$IFACE/accept_ra_defrtr=1
{% if 'interfaces' in ansible_local %}
{% if 'sup_if_6' in ansible_local.interfaces %}
{% if adh_iface.stdout in ansible_local.interfaces.sup_if_6 %}
{% for line in ansible_local.interfaces.sup_if_6[adh_iface.stdout] %}
{{ line }}
{% endfor %}
{% endif %}
{% endif %}
{% endif %}