mirror of
https://github.com/iiab/iiab.git
synced 2025-03-09 15:40:17 +00:00
try to recover/upgrade from putting wrong content in interfaces -- restore it
This commit is contained in:
parent
54789ac19c
commit
8b1de75192
4 changed files with 79 additions and 62 deletions
|
@ -29,9 +29,13 @@
|
|||
gui_desired_network_role: "lan_controller"
|
||||
when: not gui_desired_network_role is defined
|
||||
|
||||
- name: Recover from putting config in /etc/network/interfaces
|
||||
template: dest=/etc/network/interfaces
|
||||
src=network/interfaces.j2
|
||||
|
||||
- name: Copy the bridge script
|
||||
template: dest=/etc/network/interfaces.d/iiab
|
||||
src=network/interfaces.j2
|
||||
src=network/iiab.j2
|
||||
register: interface
|
||||
|
||||
- name: start up the dhcpcd service
|
||||
|
|
|
@ -27,9 +27,13 @@
|
|||
gui_desired_network_role: "LanController"
|
||||
when: not gui_desired_network_role is defined
|
||||
|
||||
- name: Rewrite the /etc/network/interfaces file which we currupted
|
||||
template: dest=/etc/network/interfaces
|
||||
src=network/interfaces.j2
|
||||
|
||||
- name: Copy the network config script
|
||||
template: dest=/etc/network/interfaces.d/iiab
|
||||
src=network/interfaces.j2
|
||||
src=network/iiab.j2
|
||||
register: interface
|
||||
|
||||
- name: If this was a change, things need to shift
|
||||
|
|
69
roles/network/templates/network/iiab.j2
Normal file
69
roles/network/templates/network/iiab.j2
Normal file
|
@ -0,0 +1,69 @@
|
|||
# This file describes the network interfaces available on your system
|
||||
# and how to activate them. For more information, see interfaces(5).
|
||||
|
||||
source /etc/network/interfaces.d/*
|
||||
|
||||
# The loopback network interface
|
||||
auto lo
|
||||
iface lo inet loopback
|
||||
|
||||
# iiab_network_mode is {{ gui_desired_network_role }}
|
||||
{% if discovered_wireless_iface != 'none' %}
|
||||
# we always want the wireless to be configured (and under bridge) if it exists
|
||||
auto {{ discovered_wireless_iface }}
|
||||
iface {{discovered_wireless_iface }} inet manual
|
||||
pre-up ifconfig $IFACE up
|
||||
pre-down ifconfig $IFACE down
|
||||
{% endif %}
|
||||
|
||||
{% if iiab_network_mode == "Appliance" %}
|
||||
################# APPLIANCE #########################
|
||||
auto {{ discovered_wan_iface }}
|
||||
{% if gui_static_wan == false %}
|
||||
iface {{ discovered_wan_iface }} inet manual
|
||||
{% else %} # gui_static_wan_ip is set
|
||||
iface {{ discovered_wan_iface }} inet static
|
||||
address {{ gui_static_wan_ip }}
|
||||
netmask {{ gui_static_wan_netmask }}
|
||||
gateway {{ gui_static_wan_gateway }}
|
||||
dns-nameservers {{ gui_static_wan_nameserver }}
|
||||
dns-search {{ iiab_domain }}
|
||||
{% endif %} {# end of static_wan #}
|
||||
{% elif iiab_network_mode == "Gateway" %}
|
||||
################# GATEWAY #########################
|
||||
auto br0
|
||||
iface br0 inet static
|
||||
bridge_ports {% if discovered_wireless_iface != "none" %} {{ discovered_wireless_iface }} {% endif %} {% if discovered_lan_iface != "none" %} {{ discovered_lan_iface }} {% endif %}
|
||||
|
||||
bridge_maxwait 0
|
||||
address {{ lan_ip }}
|
||||
netmask {{ lan_netmask }}
|
||||
dns-nameservers {{ lan_ip }}
|
||||
{% if gui_static_wan == false %}
|
||||
auto {{ discovered_wan_iface }}
|
||||
iface {{ discovered_wan_iface }} inet manual
|
||||
{% else %} # gui_static_wan_ip is set
|
||||
iface {{ discovered_wan_iface }} inet static
|
||||
address {{ gui_static_wan_ip }}
|
||||
netmask {{ gui_static_wan_netmask }}
|
||||
gateway {{ gui_static_wan_gateway }}
|
||||
dns-nameservers {{ gui_static_wan_nameserver }}
|
||||
dns-search {{ iiab_domain }}
|
||||
post-up systemctl restart dhcpd && systemctl restart hostapd
|
||||
{% endif %}
|
||||
{% else %} {# end of iiab_network_mode == Gateway #}
|
||||
|
||||
################# LANCONTROLLER ###################
|
||||
auto br0
|
||||
iface br0 inet static
|
||||
bridge_ports {% if discovered_wireless_iface != "none" %} {{ discovered_wireless_iface }} {% endif %} {% if discovered_wan_iface != "none" %} {{ discovered_wan_iface }} {% endif %}
|
||||
|
||||
bridge_maxwait 0
|
||||
address {{ lan_ip }}
|
||||
netmask {{ lan_netmask }}
|
||||
gateway {{ lan_ip }}
|
||||
dns-nameservers {{ lan_ip }}
|
||||
dns-search {{ iiab_domain }}
|
||||
post-up systemctl restart dhcpd && systemctl restart hostapd
|
||||
{% endif %}
|
||||
|
|
@ -7,63 +7,3 @@ source /etc/network/interfaces.d/*
|
|||
auto lo
|
||||
iface lo inet loopback
|
||||
|
||||
# iiab_network_mode is {{ gui_desired_network_role }}
|
||||
{% if discovered_wireless_iface != 'none' %}
|
||||
# we always want the wireless to be configured (and under bridge) if it exists
|
||||
auto {{ discovered_wireless_iface }}
|
||||
iface {{discovered_wireless_iface }} inet manual
|
||||
pre-up ifconfig $IFACE up
|
||||
pre-down ifconfig $IFACE down
|
||||
{% endif %}
|
||||
|
||||
{% if iiab_network_mode == "Appliance" %}
|
||||
################# APPLIANCE #########################
|
||||
auto {{ discovered_wan_iface }}
|
||||
{% if gui_static_wan == false %}
|
||||
iface {{ discovered_wan_iface }} inet manual
|
||||
{% else %} # gui_static_wan_ip is set
|
||||
iface {{ discovered_wan_iface }} inet static
|
||||
address {{ gui_static_wan_ip }}
|
||||
netmask {{ gui_static_wan_netmask }}
|
||||
gateway {{ gui_static_wan_gateway }}
|
||||
dns-nameservers {{ gui_static_wan_nameserver }}
|
||||
dns-search {{ iiab_domain }}
|
||||
{% endif %} {# end of static_wan #}
|
||||
{% elif iiab_network_mode == "Gateway" %}
|
||||
################# GATEWAY #########################
|
||||
auto br0
|
||||
iface br0 inet static
|
||||
bridge_ports {% if discovered_wireless_iface != "none" %} {{ discovered_wireless_iface }} {% endif %} {% if discovered_lan_iface != "none" %} {{ discovered_lan_iface }} {% endif %}
|
||||
|
||||
bridge_maxwait 0
|
||||
address {{ lan_ip }}
|
||||
netmask {{ lan_netmask }}
|
||||
dns-nameservers {{ lan_ip }}
|
||||
{% if gui_static_wan == false %}
|
||||
auto {{ discovered_wan_iface }}
|
||||
iface {{ discovered_wan_iface }} inet manual
|
||||
{% else %} # gui_static_wan_ip is set
|
||||
iface {{ discovered_wan_iface }} inet static
|
||||
address {{ gui_static_wan_ip }}
|
||||
netmask {{ gui_static_wan_netmask }}
|
||||
gateway {{ gui_static_wan_gateway }}
|
||||
dns-nameservers {{ gui_static_wan_nameserver }}
|
||||
dns-search {{ iiab_domain }}
|
||||
post-up systemctl restart dhcpd && systemctl restart hostapd
|
||||
{% endif %}
|
||||
{% else %} {# end of iiab_network_mode == Gateway #}
|
||||
|
||||
################# LANCONTROLLER ###################
|
||||
auto br0
|
||||
iface br0 inet static
|
||||
bridge_ports {% if discovered_wireless_iface != "none" %} {{ discovered_wireless_iface }} {% endif %} {% if discovered_wan_iface != "none" %} {{ discovered_wan_iface }} {% endif %}
|
||||
|
||||
bridge_maxwait 0
|
||||
address {{ lan_ip }}
|
||||
netmask {{ lan_netmask }}
|
||||
gateway {{ lan_ip }}
|
||||
dns-nameservers {{ lan_ip }}
|
||||
dns-search {{ iiab_domain }}
|
||||
post-up systemctl restart dhcpd && systemctl restart hostapd
|
||||
{% endif %}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue