mirror of
https://github.com/iiab/iiab.git
synced 2025-02-13 11:42:08 +00:00
79 lines
2.5 KiB
YAML
79 lines
2.5 KiB
YAML
- name: Restart hostapd when WiFi is present
|
|
systemd:
|
|
name: hostapd
|
|
state: restarted
|
|
when: iiab_wireless_lan_iface is defined and hostapd_enabled and iiab_network_mode != "Appliance"
|
|
|
|
- name: Start named service
|
|
systemd:
|
|
name: "{{ dns_service }}"
|
|
state: restarted
|
|
when: named_enabled and named_install
|
|
|
|
- name: Stop Squid service
|
|
systemd:
|
|
name: "{{ proxy }}"
|
|
state: stopped
|
|
async: 120
|
|
when: squid_install | bool or squid_installed is defined
|
|
|
|
- name: Stop DansGuardian
|
|
systemd:
|
|
name: dansguardian
|
|
state: stopped
|
|
when: dansguardian_install | bool or dansguardian_installed is defined
|
|
|
|
- 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 )
|
|
|
|
# Squid get re-loaded with dispatcher.d
|
|
- name: Restart Squid service ({{ proxy }})
|
|
systemd:
|
|
name: "{{ proxy }}"
|
|
state: restarted
|
|
when: squid_enabled and squid_install
|
|
|
|
- name: Restart Wondershaper service (wondershaper)
|
|
systemd:
|
|
name: wondershaper
|
|
state: restarted
|
|
when: wondershaper_enabled | bool
|
|
|
|
- name: Restart Avahi service (avahi-daemon)
|
|
systemd:
|
|
name: avahi-daemon
|
|
state: restarted
|
|
|
|
- name: Create gateway flag
|
|
shell: echo 1 > /etc/sysconfig/olpc-scripts/setup.d/installed/gateway
|
|
args:
|
|
creates: /etc/sysconfig/olpc-scripts/setup.d/installed/gateway
|
|
when: iiab_network_mode == "Gateway"
|
|
|
|
- name: Waiting {{ hostapd_wait }} seconds for network to stabilize (dnsmasq will fail if br0 isn't in a 'up' state!)
|
|
shell: sleep {{ hostapd_wait }}
|
|
|
|
- name: Run /usr/bin/iiab-gen-iptables
|
|
command: /usr/bin/iiab-gen-iptables
|
|
|
|
- name: Checking if WiFi slave is active
|
|
shell: brctl show br0 | grep {{ iiab_wireless_lan_iface }} | wc -l
|
|
when: hostapd_enabled and iiab_wireless_lan_iface is defined and iiab_lan_iface == "br0"
|
|
register: wifi_slave
|
|
|
|
- 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
|
|
|
|
- name: User choice of dnsmasq or dhcpd - restarting {{ dhcp_service2 }}
|
|
systemd:
|
|
name: "{{ dhcp_service2 }}"
|
|
state: restarted
|
|
#when: (iiab_network_mode != "Appliance") # Sufficient b/c br0 exists thanks to /etc/network/interfaces.d/iiab
|
|
#when: (iiab_network_mode != "Appliance") and (not no_net_restart)
|
|
#when: iiab_network_mode != "Appliance" and iiab_wan_iface != discovered_wireless_iface
|