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/restart.yml

91 lines
3.1 KiB
YAML
Raw Normal View History

2020-05-06 19:51:40 +00:00
- name: Restart wpa_supplicant service
2020-05-04 12:56:55 +00:00
systemd:
name: "{{ item }}"
state: restarted
with_items:
- wpa_supplicant
2020-05-06 19:51:40 +00:00
when: wifi_up_down and hostapd_enabled
2020-05-04 12:56:55 +00:00
- name: Reload netplan for Wifi gateway on Ubuntu 18+
shell: netplan apply
when: wifi_up_down and is_ubuntu and netplan.stdout.find("yaml") != -1
2017-05-27 18:09:50 +00:00
- name: Start named service
2018-11-04 03:39:03 +00:00
systemd:
name: "{{ dns_service }}"
state: restarted
when: named_enabled and named_install
2017-05-27 18:09:50 +00:00
- name: Stop Squid service
2018-11-04 03:39:03 +00:00
systemd:
name: "{{ proxy }}"
state: stopped
2017-11-11 23:43:55 +00:00
async: 120
when: squid_install or squid_installed is defined
2017-05-27 18:09:50 +00:00
2017-11-03 03:52:13 +00:00
- name: Stop DansGuardian
2018-11-04 03:39:03 +00:00
systemd:
name: dansguardian
state: stopped
when: dansguardian_install or dansguardian_installed is defined
2017-11-03 03:52:13 +00:00
2018-11-04 03:39:03 +00:00
- name: Restart DansGuardian service (dansguardian) except Ubuntu which needs reboot to activate
systemd:
name: dansguardian
state: restarted
when: dansguardian_enabled and dansguardian_install and ( not is_ubuntu and iiab_stage|int < 4 )
2017-05-27 18:09:50 +00:00
# Squid get re-loaded with dispatcher.d
2018-11-04 03:39:03 +00:00
- name: Restart Squid service ({{ proxy }})
systemd:
name: "{{ proxy }}"
state: restarted
when: squid_enabled and squid_install
2017-05-27 18:09:50 +00:00
2018-11-04 03:39:03 +00:00
- name: Restart Wondershaper service (wondershaper)
systemd:
name: wondershaper
state: restarted
when: wondershaper_enabled
2017-05-27 18:09:50 +00:00
2018-11-04 03:39:03 +00:00
- name: Restart Avahi service (avahi-daemon)
systemd:
name: avahi-daemon
state: restarted
2017-05-27 18:09:50 +00:00
2020-04-26 21:44:41 +00:00
#netplan de-configures pre-created bridged interfaces
#- name: Reload netplan when Wifi is not gateway on Ubuntu 18+
# shell: netplan apply
# when: not no_net_restart and is_ubuntu and netplan.stdout.find("yaml") != -1
2019-07-07 04:09:59 +00:00
- name: Waiting {{ hostapd_wait }} seconds for network to stabilize (dnsmasq will fail if br0 isn't in a 'up' state!)
shell: sleep {{ hostapd_wait }}
2018-11-04 03:39:03 +00:00
- name: Run /usr/bin/iiab-gen-iptables
command: /usr/bin/iiab-gen-iptables
2017-11-08 06:58:26 +00:00
- name: Checking if WiFi slave is active
shell: brctl show br0 | grep {{ iiab_wireless_lan_iface }} | wc -l
2020-05-04 12:56:55 +00:00
# when: hostapd_enabled and discovered_wireless_iface != iiab_wan_iface and iiab_lan_iface == "br0"
when: hostapd_enabled and iiab_lan_iface == "br0"
2017-10-16 01:33:12 +00:00
register: wifi_slave
2017-11-08 06:58:26 +00:00
- name: Restart hostapd if WiFi slave is inactive
systemd:
name: hostapd
state: restarted
when: hostapd_enabled and wifi_slave.stdout is defined and wifi_slave.stdout == 0
2020-05-04 00:18:20 +00:00
#both interfaces.d and systemd-networkd should have br0 available and Appliance lacks br0
2020-05-04 12:56:55 +00:00
#keep an eye on legacy wifi installs where br0 is present but not 'online' with an ip address
#due to hostapd didn't go to a carrier state. All others should get dnsmasq restarted
2019-07-07 04:35:38 +00:00
- name: User choice of dnsmasq or dhcpd - restarting {{ dhcp_service2 }}
2018-11-04 03:39:03 +00:00
systemd:
name: "{{ dhcp_service2 }}"
state: restarted
when: (not no_net_restart or (is_ubuntu and wifi_up_down)) or (iiab_stage|int == 9)
#when: (not no_net_restart or (is_ubuntu_20 and wifi_up_down)) or (iiab_stage|int == 9)
#when: (not no_net_restart or (is_ubuntu_20 and wifi_up_down))
2019-06-20 00:07:53 +00:00
#when: (iiab_network_mode != "Appliance") # Sufficient b/c br0 exists thanks to /etc/network/interfaces.d/iiab
2019-02-25 17:00:46 +00:00
#when: iiab_network_mode != "Appliance" and iiab_wan_iface != discovered_wireless_iface