1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-13 19:52:06 +00:00
iiab/roles/network/tasks/rpi_debian.yml

83 lines
2.6 KiB
YAML
Raw Normal View History

2017-05-27 18:09:50 +00:00
# rpi_debian.yml
# Start out making simplifying assumptions
2017-05-27 18:09:50 +00:00
# 1. we are dealing with a rpi3
# 2. Gui inputs define the config -- auto config is more difficult
# a. gui_desired_network_role
# b. hostapd_enabled
# c. gui_static_wan_ip
2017-05-27 18:09:50 +00:00
# 3. In appliance mode: wan (and wlan0) is either static or dhcp under br0, and hostapd off
# 4. In lan_controller: wan is off, eth0 and wlan0 under br0
# 5. In gateway: eth0 is wan, and wlan0 is under br0 (only one adapter under br0)
# 6. As a slight concess to auto config, if eth1 exists, make it wan, and force gateway
2017-10-27 17:56:51 +00:00
- name: Raspbian stock has openresolv which is not available in Debian, off it
2017-05-27 18:09:50 +00:00
package: name=openresolv
state=absent
- name: Get the stock resolv.conf manager
package: name=resolvconf
state=absent
2017-05-27 18:09:50 +00:00
2017-10-27 16:17:09 +00:00
- name: On upgrade from earlier IIAB versions, remove /etc/network/interfaces.d/br0
2017-05-27 18:09:50 +00:00
file: path=/etc/network/interfaces.d/br0
state=absent
2017-09-10 01:54:23 +00:00
when: iiab_lan_iface != "br0" and wan_ip == "dhcp"
2017-05-27 18:09:50 +00:00
2017-10-27 17:56:51 +00:00
- name: Default to 'LanController'
2017-05-27 18:09:50 +00:00
set_fact:
gui_desired_network_role: "LanController"
when: not gui_desired_network_role is defined
- name: Rewrite the /etc/network/interfaces file which we corrupted
2017-05-27 18:09:50 +00:00
template: dest=/etc/network/interfaces
src=network/interfaces.j2
- name: Supply our own dhcpcd.conf
template: dest=/etc/dhcpcd.conf
2017-09-10 01:54:23 +00:00
src=network/dhcpcd.conf.j2
when: iiab_lan_iface == "br0" or wan_ip != "dhcp"
- name: Copy the network config script
template: dest=/etc/network/interfaces.d/iiab
2017-09-16 07:07:18 +00:00
src=network/systemd.j2
2017-05-27 18:09:50 +00:00
register: interface
2017-09-10 01:54:23 +00:00
when: iiab_lan_iface == "br0" or wan_ip != "dhcp"
2017-05-27 18:09:50 +00:00
- name: If this was a change, things need to shift
service: name=hostapd state=stopped
when: interface.changed
- name: dhcpcd may be affected
service: name=dhcpcd state=stopped
2017-05-27 18:09:50 +00:00
when: interface.changed
- name: Tear down any bridge and start fresh
command: ip link set br0 down
ignore_errors: True
when: interface.changed
2017-10-27 15:59:36 +00:00
- name: And remove the device
2017-05-27 18:09:50 +00:00
command: brctl delbr br0
ignore_errors: True
when: interface.changed
2017-10-27 15:59:36 +00:00
- name: Reset the eth0 interface
command: ifdown eth0
2017-05-27 18:09:50 +00:00
ignore_errors: True
when: interface.changed
2017-11-08 07:00:07 +00:00
- name: Start up dhcpcd again
service: name=dhcpcd state=started
2017-05-27 18:09:50 +00:00
# now pick up denyinterfaces
2017-11-08 07:00:07 +00:00
- name: Restart dhcpcd
service: name=dhcpcd state=restarted
2017-11-08 07:00:07 +00:00
- name: Restart the networking service
service: name=networking state=restarted
2017-05-27 18:09:50 +00:00
#create lan br0 if lan_controller or gateway
#create wan br0 if appliance
#allocate wlan0 under br0 in all cases
#allocate eth0 under br0 if appliance, alone if gateway