2017-05-27 18:09:50 +00:00
|
|
|
# debian.yml
|
2017-10-19 06:33:02 +00:00
|
|
|
# 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
|
2017-10-19 06:33:02 +00:00
|
|
|
# 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-11-23 03:15:22 +00:00
|
|
|
|
2017-09-16 07:07:18 +00:00
|
|
|
#- name: In upgrade from earlier IIAB 6.2, delete the resolvconf
|
|
|
|
# package: name=resolvconf
|
|
|
|
# state=absent
|
|
|
|
# enabled=False
|
|
|
|
# ignore_errors: True
|
2017-10-19 06:33:02 +00:00
|
|
|
|
2017-09-16 07:07:18 +00:00
|
|
|
#- name: Get the dhcp client daemon used in recent raspbian
|
|
|
|
# package: name=dhcpcd5
|
|
|
|
# state=present
|
2017-05-27 18:09:50 +00:00
|
|
|
|
2017-10-27 16:05:27 +00:00
|
|
|
- name: For upgrades from earlier IIAB 6.2, remove br0 file
|
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-09-10 01:54:23 +00:00
|
|
|
- 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
|
2017-11-01 12:45:55 +00:00
|
|
|
when: dhcpcd_result == "enabled"
|
2017-09-16 05:31:09 +00:00
|
|
|
|
2017-10-19 06:33:02 +00:00
|
|
|
- name: Copy the bridge script
|
2017-09-16 05:31:09 +00:00
|
|
|
template: dest=/etc/network/interfaces.d/iiab
|
2017-09-16 07:07:18 +00:00
|
|
|
src=network/systemd.j2
|
2018-05-14 18:22:32 +00:00
|
|
|
when: not is_rpi and (iiab_lan_iface == "br0" or wan_ip != "dhcp" or gui_static_wan_ip == "undefined")
|
2017-05-27 18:09:50 +00:00
|
|
|
|
2017-11-05 16:59:57 +00:00
|
|
|
- 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"
|
|
|
|
|
2018-05-13 20:24:19 +00:00
|
|
|
- name: Workaround auto issue on Debian-9
|
|
|
|
template: dest=/etc/network/interfaces.d/patch_auto
|
2018-05-14 15:02:32 +00:00
|
|
|
src=network/debian-auto.j2
|
2018-05-13 20:24:19 +00:00
|
|
|
when: iiab_wan_iface != "none" and is_debian_9
|
|
|
|
|
2018-05-13 21:11:02 +00:00
|
|
|
- name: Clearing out /etc/network/interfaces for static addresses (is_debian_9)
|
|
|
|
lineinfile:
|
|
|
|
state: absent
|
|
|
|
path: /etc/network/interfaces
|
|
|
|
regexp: "{{ iiab_wan_iface }}"
|
|
|
|
when: wan_ip != "dhcp" and iiab_wan_iface != "none" and is_debian_9
|
|
|
|
|
2017-09-13 11:07:25 +00:00
|
|
|
- name: bind may be affected
|
|
|
|
service: name={{ dns_service }} state=stopped
|
|
|
|
when: named_install and dnsmasq_enabled
|
2017-05-27 18:09:50 +00:00
|
|
|
|
2017-09-13 11:07:25 +00:00
|
|
|
# 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
|
2017-10-19 06:33:02 +00:00
|
|
|
|
2017-11-10 16:33:19 +00:00
|
|
|
- name: Reload systemd
|
2018-04-07 21:45:04 +00:00
|
|
|
systemd:
|
|
|
|
daemon_reload: yes
|
2017-09-09 21:12:05 +00:00
|
|
|
|
|
|
|
# now pick up denyinterfaces
|
2017-11-10 16:33:19 +00:00
|
|
|
- name: Restart dhcpcd
|
2017-09-09 21:12:05 +00:00
|
|
|
service: name=dhcpcd state=restarted
|
2017-11-01 12:45:55 +00:00
|
|
|
when: dhcpcd_result == "enabled"
|
2017-05-27 18:09:50 +00:00
|
|
|
|
2017-11-10 16:33:19 +00:00
|
|
|
- name: Restart the networking service
|
2017-11-01 23:50:10 +00:00
|
|
|
service: name=networking state=restarted
|
2017-11-23 03:15:22 +00:00
|
|
|
when: not nobridge is defined and not no_net_restart
|