1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-13 11:42:08 +00:00
iiab/roles/network/tasks/debian.yml
2017-11-22 18:01:04 -06:00

106 lines
3.7 KiB
YAML

# debian.yml
# Start out making simplifying assumptions
# 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
# 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
#- name: In upgrade from earlier IIAB 6.2, delete the resolvconf
# package: name=resolvconf
# state=absent
# enabled=False
# ignore_errors: True
#- name: Get the dhcp client daemon used in recent raspbian
# package: name=dhcpcd5
# state=present
- name: For upgrades from earlier IIAB 6.2, remove br0 file
file: path=/etc/network/interfaces.d/br0
state=absent
when: iiab_lan_iface != "br0" and wan_ip == "dhcp"
- name: Supply resolvconf.conf
template: dest=/etc/resolvconf.conf
src=network/resolvconf.j2
- name: Supply dhcpcd.conf
template: dest=/etc/dhcpcd.conf
src=network/dhcpcd.conf.j2
when: dhcpcd_result == "enabled"
- name: Copy the bridge script
template: dest=/etc/network/interfaces.d/iiab
src=network/systemd.j2
when: not is_rpi and not has_NM and (iiab_lan_iface == "br0" or wan_ip != "dhcp")
- name: Copy the bridge script for RPi
template: dest=/etc/network/interfaces.d/iiab
src=network/rpi.j2
when: is_rpi and iiab_lan_iface == "br0"
- name: bind may be affected
service: name={{ dns_service }} state=stopped
when: named_install and dnsmasq_enabled
# dhcpd_server release the interface
- name: dhcpd_server may be affected - stopping dhcpd
service: name=dhcpd state=stopped
when: dhcpd_install
- name: dhcpd_server may be affected - stopping dnsmasq
service: name=dnsmasq state=stopped
when: dnsmasq_install
# do this
#- name: Copy NetworkManager.conf for has_NM
# template: dest=/etc/NetworkManager/NetworkManager.conf
# src=network/NetworkManager.conf
# when: has_NM and iiab_lan_iface == "br0"
#- name: Copy the bridge script for has_NM
# template: dest=/etc/network/interfaces
# src=network/systemd.j2
# when: has_NM and not wan_in_interfaces and iiab_lan_iface == "br0"
# or provide keyfile layout like the XO's used way back.
- name: Create uuid for NM
shell: uuidgen
register: uuid_response
when: has_NM and not wan_in_interfaces and iiab_lan_iface == "br0"
- name: Put the uuid in place
set_fact:
gen_uuid: "{{ uuid_response.stdout_lines[0] }}"
when: has_NM and not wan_in_interfaces and iiab_lan_iface == "br0"
# NM might have a watcher on this path and we don't have to restart NM
- name: Copy the bridge script for has_NM
template: dest=/etc/NetworkManager/system-connections/
src=network/bridge-br0
when: has_NM and not wan_in_interfaces and iiab_lan_iface == "br0"
- name: Reload systemd
shell: systemctl daemon-reload
# now pick up denyinterfaces
- name: Restart dhcpcd
service: name=dhcpcd state=restarted
when: dhcpcd_result == "enabled"
- name: Restart the networking service
service: name=networking state=restarted
when: not nobridge is defined and not has_NM and not no_net_restart
- name: Restart hostapd when WiFi is present
service: name=hostapd 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"