network_interfaces is working for my router
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
This commit is contained in:
parent
f1ac6f269b
commit
f57b1f1b3e
@ -4,7 +4,7 @@ glob_network_interfaces:
|
||||
id: 1
|
||||
gateway: "185.230.76.62"
|
||||
dns: "{{ query('ldap', 'ip', 'routeur-templier', 'srv') | ipv4 | first }}"
|
||||
gateway_v6: "2a0c:700:3002::ff:fe02:102"
|
||||
gateway_v6: "2a0c:700:3012::ff:fe02:112"
|
||||
- name: adm
|
||||
id: 42
|
||||
dns: "{{ query('ldap', 'ip', 'routeur-templier', 'adm') | ipv4 | first }}"
|
||||
|
5
host_vars/routeur-templier.adm.ynerant.fr.yml
Normal file
5
host_vars/routeur-templier.adm.ynerant.fr.yml
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
interfaces:
|
||||
adm: ens18
|
||||
srv: ens19
|
||||
srv_nat: ens20
|
@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env ansible-playbook
|
||||
---
|
||||
- hosts: vm,!routeur
|
||||
- hosts: vm
|
||||
vars:
|
||||
network_interfaces: "{{ glob_network_interfaces | default({}) | combine(loc_network_interfaces | default({})) }}"
|
||||
roles:
|
||||
|
@ -12,7 +12,7 @@ iface {{ interfaces[item.name] }} inet static
|
||||
{% endfor %}
|
||||
network {{ subnet_network }}
|
||||
netmask {{ subnet_netmask }}
|
||||
{% if item.gateway is defined %}
|
||||
{% if item.gateway is defined and item.gateway not in (ips | ipv4) %}
|
||||
gateway {{ item.gateway }}
|
||||
{% endif %}
|
||||
{% if item.metric is defined %}
|
||||
@ -41,7 +41,7 @@ iface {{ interfaces[item.name] }} inet6 static
|
||||
{% for ip in (ips | ipv6) %}
|
||||
address {{ ip }}/64
|
||||
{% endfor %}
|
||||
{% if item.gateway_v6 is defined %}
|
||||
{% if item.gateway_v6 is defined and item.gateway_v6 not in (ips | ipv6) %}
|
||||
gateway {{ item.gateway_v6 }}
|
||||
{% endif %}
|
||||
accept_ra 0
|
||||
|
Loading…
Reference in New Issue
Block a user