mirror of
https://github.com/iiab/iiab.git
synced 2025-03-09 15:40:17 +00:00
rpi_debian.yml
This commit is contained in:
parent
24269d2b4b
commit
e762dd3d8d
2 changed files with 59 additions and 67 deletions
|
@ -93,13 +93,14 @@
|
||||||
- include_tasks: debian.yml
|
- include_tasks: debian.yml
|
||||||
tags:
|
tags:
|
||||||
- network
|
- network
|
||||||
when: is_debuntu
|
when: is_debuntu and not is_rpi
|
||||||
#and not is_rpi and not installing
|
#and not installing
|
||||||
|
|
||||||
#- include_tasks: rpi_debian.yml
|
- include_tasks: rpi_debian.yml
|
||||||
# tags:
|
tags:
|
||||||
# - network
|
- network
|
||||||
# when: is_debuntu and is_rpi and not installing
|
when: is_debuntu and is_rpi
|
||||||
|
#and not installing
|
||||||
|
|
||||||
- name: Record iiab_wan_device
|
- name: Record iiab_wan_device
|
||||||
lineinfile: dest=/etc/iiab/iiab.env
|
lineinfile: dest=/etc/iiab/iiab.env
|
||||||
|
|
|
@ -5,78 +5,69 @@
|
||||||
# a. gui_desired_network_role
|
# a. gui_desired_network_role
|
||||||
# b. hostapd_enabled
|
# b. hostapd_enabled
|
||||||
# c. gui_static_wan_ip
|
# c. gui_static_wan_ip
|
||||||
# 3. In appliance mode: wan (and wlan0) is either static or dhcp under br0, and hostapd off
|
# 3. In appliance mode: wan is either wired dhcp/static or wlan0 and hostapd off
|
||||||
# 4. In lan_controller: wan is off, eth0 and wlan0 under br0
|
# 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)
|
# 5. In gateway: user gateway is wan, and wlan0 under br0 if not acting as
|
||||||
# 6. As a slight concess to auto config, if eth1 exists, make it wan, and force gateway
|
# the gateway
|
||||||
|
|
||||||
- name: Raspbian stock has openresolv which is not available in Debian, off it
|
- name: Supply resolvconf.conf
|
||||||
package: name=openresolv
|
template:
|
||||||
state=absent
|
dest: /etc/resolvconf.conf
|
||||||
|
src: network/resolvconf.j2
|
||||||
|
|
||||||
- name: Get the stock resolv.conf manager
|
- name: Supply dhcpcd.conf
|
||||||
package: name=resolvconf
|
template:
|
||||||
state=absent
|
dest: /etc/dhcpcd.conf
|
||||||
|
src: network/dhcpcd.conf.j2
|
||||||
|
|
||||||
- name: On upgrade from earlier IIAB versions, remove /etc/network/interfaces.d/br0
|
- name: Copy the bridge script for RPi
|
||||||
file: path=/etc/network/interfaces.d/br0
|
template:
|
||||||
state=absent
|
dest: /etc/network/interfaces.d/iiab
|
||||||
when: iiab_lan_iface != "br0" and wan_ip == "dhcp"
|
src: network/rpi.j2
|
||||||
|
when: iiab_lan_iface == "br0"
|
||||||
|
|
||||||
- name: Default to 'LanController'
|
- name: bind may be affected
|
||||||
set_fact:
|
service:
|
||||||
gui_desired_network_role: "LanController"
|
name: "{{ dns_service }}"
|
||||||
when: not gui_desired_network_role is defined
|
state: stopped
|
||||||
|
when: named_install and dnsmasq_enabled
|
||||||
|
|
||||||
- name: Rewrite the /etc/network/interfaces file which we corrupted
|
# dhcpd_server release the interface
|
||||||
template: dest=/etc/network/interfaces
|
- name: dhcpd_server may be affected - stopping dhcpd
|
||||||
src=network/interfaces.j2
|
service:
|
||||||
|
name: dhcpd
|
||||||
|
state: stopped
|
||||||
|
when: dhcpd_install
|
||||||
|
|
||||||
- name: Supply our own dhcpcd.conf
|
- name: dhcpd_server may be affected - stopping dnsmasq
|
||||||
template: dest=/etc/dhcpcd.conf
|
service:
|
||||||
src=network/dhcpcd.conf.j2
|
name: dnsmasq
|
||||||
when: iiab_lan_iface == "br0" or wan_ip != "dhcp"
|
state: stopped
|
||||||
|
when: dnsmasq_install
|
||||||
|
|
||||||
- name: Copy the network config script
|
- name: Reload systemd
|
||||||
template: dest=/etc/network/interfaces.d/iiab
|
shell: systemctl daemon-reload
|
||||||
src=network/systemd.j2
|
|
||||||
register: interface
|
|
||||||
when: iiab_lan_iface == "br0" or wan_ip != "dhcp"
|
|
||||||
|
|
||||||
- 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
|
|
||||||
when: interface.changed
|
|
||||||
|
|
||||||
- name: Tear down any bridge and start fresh
|
|
||||||
command: ip link set br0 down
|
|
||||||
ignore_errors: True
|
|
||||||
when: interface.changed
|
|
||||||
|
|
||||||
- name: And remove the device
|
|
||||||
command: brctl delbr br0
|
|
||||||
ignore_errors: True
|
|
||||||
when: interface.changed
|
|
||||||
|
|
||||||
- name: Reset the eth0 interface
|
|
||||||
command: ifdown eth0
|
|
||||||
ignore_errors: True
|
|
||||||
when: interface.changed
|
|
||||||
|
|
||||||
- name: Start up dhcpcd again
|
|
||||||
service: name=dhcpcd state=started
|
|
||||||
|
|
||||||
# now pick up denyinterfaces
|
# now pick up denyinterfaces
|
||||||
- name: Restart dhcpcd
|
- name: Restart dhcpcd
|
||||||
service: name=dhcpcd state=restarted
|
service:
|
||||||
|
name: dhcpcd
|
||||||
|
state: restarted
|
||||||
|
|
||||||
- name: Restart the networking service
|
- name: Restart the networking service
|
||||||
service: name=networking state=restarted
|
service:
|
||||||
|
name: networking
|
||||||
|
enabled: yes
|
||||||
|
state: restarted
|
||||||
|
when: not nobridge is defined and not has_NM and not no_net_restart
|
||||||
|
|
||||||
#create lan br0 if lan_controller or gateway
|
- name: Restart hostapd when WiFi is present
|
||||||
#create wan br0 if appliance
|
service:
|
||||||
#allocate wlan0 under br0 in all cases
|
name: hostapd
|
||||||
#allocate eth0 under br0 if appliance, alone if gateway
|
enabled: yes
|
||||||
|
state: restarted
|
||||||
|
when: iiab_wireless_lan_iface is defined and hostapd_enabled and iiab_network_mode != "Appliance"
|
||||||
|
|
||||||
|
#- name: dhcp_server may be affected - starting - user choice
|
||||||
|
# service: name={{ dhcp_service2 }} state=started
|
||||||
|
# when: iiab_network_mode != "Appliance"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue