[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: loc_borg:
to_exclude: to_exclude:
- /var/mail - /var/mail

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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