[interfaces] Configure switch interface
parent
3a56fd406b
commit
05d2349f62
|
@ -15,6 +15,9 @@
|
||||||
- shell: grep borne /sys/class/net/*/ifalias | sed "s|/sys/class/net/||" | sed "s|/ifalias:.*||"
|
- shell: grep borne /sys/class/net/*/ifalias | sed "s|/sys/class/net/||" | sed "s|/ifalias:.*||"
|
||||||
register: borne_iface
|
register: borne_iface
|
||||||
check_mode: no
|
check_mode: no
|
||||||
|
- shell: grep switch /sys/class/net/*/ifalias | sed "s|/sys/class/net/||" | sed "s|/ifalias:.*||"
|
||||||
|
register: switch_iface
|
||||||
|
check_mode: no
|
||||||
- shell: grep fil /sys/class/net/*/ifalias | sed "s|/sys/class/net/||" | sed "s|/ifalias:.*||"
|
- shell: grep fil /sys/class/net/*/ifalias | sed "s|/sys/class/net/||" | sed "s|/ifalias:.*||"
|
||||||
register: fil_iface
|
register: fil_iface
|
||||||
check_mode: no
|
check_mode: no
|
||||||
|
@ -29,7 +32,8 @@
|
||||||
- ens_gateway: 138.231.136.254
|
- ens_gateway: 138.231.136.254
|
||||||
- ens_dns: 138.231.136.152 138.231.136.4
|
- ens_dns: 138.231.136.152 138.231.136.4
|
||||||
- adm_dns: 10.231.136.152 10.231.136.4
|
- adm_dns: 10.231.136.152 10.231.136.4
|
||||||
- borne_dns: 10.231.148.4
|
- borne_dns: 10.231.148.52 10.231.148.4
|
||||||
|
- switch_dns: 10.231.100.152 10.231.100.4
|
||||||
- fil_gateway: 10.54.0.254
|
- fil_gateway: 10.54.0.254
|
||||||
- fil_dns: 10.54.0.152 10.54.0.4
|
- fil_dns: 10.54.0.152 10.54.0.4
|
||||||
- adh_gateway: 185.230.78.254
|
- adh_gateway: 185.230.78.254
|
||||||
|
|
|
@ -33,6 +33,13 @@
|
||||||
mode: 0644
|
mode: 0644
|
||||||
when: borne_iface.stdout
|
when: borne_iface.stdout
|
||||||
|
|
||||||
|
- name: Deploy switch interface config
|
||||||
|
template:
|
||||||
|
src: network/interfaces.d/04-switch.j2
|
||||||
|
dest: /etc/network/interfaces.d/04-switch
|
||||||
|
mode: 0644
|
||||||
|
when: switch_iface.stdout
|
||||||
|
|
||||||
- name: Deploy fil interface config
|
- name: Deploy fil interface config
|
||||||
template:
|
template:
|
||||||
src: network/interfaces.d/21-fil.j2
|
src: network/interfaces.d/21-fil.j2
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
{{ ansible_header | comment }}
|
||||||
|
|
||||||
|
{% set switch = hostvars[inventory_hostname]['ansible_' + switch_iface.stdout] %}
|
||||||
|
allow-hotplug {{ switch_iface.stdout }}
|
||||||
|
iface {{ switch_iface.stdout }} inet static
|
||||||
|
address {{ switch.ipv4.address }}
|
||||||
|
network {{ switch.ipv4.network }}
|
||||||
|
netmask {{ switch.ipv4.netmask }}
|
||||||
|
broadcast {{ switch.ipv4.broadcast }}
|
||||||
|
mtu 1496
|
||||||
|
dns-nameservers {{ switch_dns }}
|
||||||
|
dns-search switch.crans.org
|
||||||
|
up /sbin/ip link set $IFACE alias switch
|
||||||
|
{% if 'interfaces' in ansible_local %}
|
||||||
|
{% if 'sup_if_4' in ansible_local.interfaces %}
|
||||||
|
{% if switch_iface.stdout in ansible_local.interfaces.sup_if_4 %}
|
||||||
|
{% for line in ansible_local.interfaces.sup_if_4[switch_iface.stdout] %}
|
||||||
|
{{ line }}
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
iface {{ switch_iface.stdout }} inet6 static
|
||||||
|
address {{ switch.ipv6[0].address }}/{{ switch.ipv6[0].prefix }}
|
||||||
|
{% if 'interfaces' in ansible_local %}
|
||||||
|
{% if 'sup_if_6' in ansible_local.interfaces %}
|
||||||
|
{% if switch_iface.stdout in ansible_local.interfaces.sup_if_6 %}
|
||||||
|
{% for line in ansible_local.interfaces.sup_if_6[switch_iface.stdout] %}
|
||||||
|
{{ line }}
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
Loading…
Reference in New Issue