[iface] disable automatic deployment from interfaces variable

main
_shirenn 2022-11-19 19:37:54 +01:00
parent 2460120450
commit 332955082d
19 changed files with 45 additions and 5 deletions

View File

@ -1,4 +1,7 @@
---
interfaces:
disable: true
loc_borg:
to_exclude:
- /var/mail

View File

@ -1,4 +1,5 @@
---
interfaces:
disable: true
adm: ens18
san: ens19

View File

@ -1,4 +1,7 @@
---
interfaces:
disable: true
loc_slapd:
ip: "{{ query('ldap', 'ip4', 'daniel', 'adm') }}"
replica: true

View File

@ -1,4 +1,7 @@
---
interfaces:
disable: true
loc_borg:
to_backup:
- /etc

View File

@ -1,4 +1,7 @@
---
interfaces:
disable: true
loc_debian_images:
include_extra_images: true

View File

@ -1,4 +1,7 @@
---
interfaces:
disable: true
loc_slapd:
ip: "{{ query('ldap', 'ip4', 'jack', 'adm') }}"
replica: true

View File

@ -1,4 +1,5 @@
---
interfaces:
disable: true
adm: ens18
san: ens19

View File

@ -1,4 +1,7 @@
---
interfaces:
disable: true
loc_debian_images:
include_extra_images: true

View File

@ -1,5 +1,6 @@
---
interfaces:
disable: true
adm: ens18
via: ens19
aurore: ens20

View File

@ -1,5 +1,6 @@
---
interfaces:
disable: true
adm: ens18
via: ens19
aurore: ens20

View File

@ -1,5 +1,6 @@
---
interfaces:
disable: true
adm: ens18
via: ens19
aurore: ens20

View File

@ -1,4 +1,7 @@
---
interfaces:
disable: true
loc_borg:
to_backup:
- /etc

View File

@ -1,3 +1,6 @@
---
interfaces:
disable: true
loc_debian_images:
include_extra_images: true

View File

@ -1,4 +1,7 @@
---
interfaces:
disable: true
debian_mirror: 'file:/pool/mirror/pub/debian'
loc_postgres:

View File

@ -1,4 +1,7 @@
---
interfaces:
disable: true
loc_borg:
to_backup:
- /etc

View File

@ -1,4 +1,7 @@
---
interfaces:
disable: true
loc_borg:
to_exclude:
- /var/mail

View File

@ -1,6 +1,6 @@
#!/usr/bin/env ansible-playbook
---
- hosts: crans_vm,!routeurs_vm
- hosts: server
vars:
network_interfaces: "{{ glob_network_interfaces | default({}) | combine(loc_network_interfaces | default({})) }}"
roles:

View File

@ -35,7 +35,7 @@ include "./dhcp-failover.conf";
{% for subnet in dhcp.subnets %}
subnet {{ subnet.network | ansible.utils.netaddr('network') }} netmask {{ subnet.network | ansible.utils.netaddr('netmask') }} {
subnet {{ subnet.network | ansible.utils.ipaddr('network') }} netmask {{ subnet.network | ansible.utils.ipaddr('netmask') }} {
interface "{{ interfaces[subnet.vlan] }}";
{% if subnet.default_lease_time is defined %}
default-lease-time {{ subnet.default_lease_time }};
@ -43,8 +43,8 @@ subnet {{ subnet.network | ansible.utils.netaddr('network') }} netmask {{ subnet
{% if subnet.max_lease_time is defined %}
max-lease-time {{ subnet.max_lease_time }};
{% endif %}
option subnet-mask {{ subnet.network | ansible.utils.netaddr('netmask') }};
option broadcast-address {{ subnet.network | ansible.utils.netaddr('broadcast') }};
option subnet-mask {{ subnet.network | ansible.utils.ipaddr('netmask') }};
option broadcast-address {{ subnet.network | ansible.utils.ipaddr('broadcast') }};
{% if subnet.routers is defined %}
option routers {{ subnet.routers }};
{% endif %}

View File

@ -9,17 +9,19 @@
register: apt_result
retries: 3
until: apt_result is succeeded
when: not (interfaces.disable is defined and interfaces.disable)
- name: Deploy default interfaces config
template:
src: network/interfaces.j2
dest: /etc/network/interfaces
mode: 0644
when: interfaces is defined and not (interfaces.disable is defined and interfaces.disable)
- name: Deploy interfaces config
template:
src: network/interfaces.d/ifalias.j2
dest: /etc/network/interfaces.d/{{ '%02d' | format(item.id) }}-{{ item.name | replace('_', '-') }}
mode: 0644
when: item.name in interfaces
when: interfaces is defined and item.name in interfaces and not (interfaces.disable is defined and interfaces.disable)
loop: "{{ network_interfaces.vlan }}"