From c2730635a64d229c53c483925ecc3b3b3cd68a07 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sun, 3 May 2020 14:00:20 -0500 Subject: [PATCH 1/6] override 'vars' if the hardware is not present --- roles/network/tasks/hostapd.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/network/tasks/hostapd.yml b/roles/network/tasks/hostapd.yml index 8800edc95..5ce1ff2e2 100644 --- a/roles/network/tasks/hostapd.yml +++ b/roles/network/tasks/hostapd.yml @@ -4,10 +4,10 @@ enabled: no masked: no -- name: Disable hostapd when not using ap0 and wifi gateway present +- name: Disable hostapd when not using ap0 and wifi gateway present or no WiFi hardware present set_fact: hostapd_enabled: False - when: not wifi_up_down and discovered_wireless_iface == iiab_wan_iface + when: (not wifi_up_down and discovered_wireless_iface == iiab_wan_iface) or discovered_wireless_iface == "none" - name: Detect current Wifi channel shell: iw {{ discovered_wireless_iface }} info | grep channel | cut -d' ' -f2 From 5bd975db5e9b7f9d12f189b4cad0ac3466dc8b2b Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sun, 3 May 2020 14:02:14 -0500 Subject: [PATCH 2/6] the intent is to not restart hostapd during wifi installs --- roles/network/tasks/restart.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/roles/network/tasks/restart.yml b/roles/network/tasks/restart.yml index 6cecec5c4..f75b27dae 100644 --- a/roles/network/tasks/restart.yml +++ b/roles/network/tasks/restart.yml @@ -1,9 +1,14 @@ -- name: Restart hostapd when WiFi is present +#iiab_wireless_lan_iface(wlan0) - wifi_up_down False needs hw +#iiab_wireless_lan_iface(ap0) - wifi_up_down True needs hw +#hostapd_enabled False - set in hostapd.yml to avoid the enable with wifi_up_down False +#no_net_restart: True - main.yml discovered_wireless_iface == iiab_wan_iface +- name: Restart hostapd when WiFi is present but not when using WiFi as gateway systemd: name: hostapd state: restarted # when: iiab_wireless_lan_iface is defined and hostapd_enabled and discovered_wireless_iface != iiab_wan_iface - when: hostapd_enabled and iiab_wireless_lan_iface is defined and discovered_wireless_iface == iiab_wireless_lan_iface +# when: hostapd_enabled and iiab_wireless_lan_iface is defined and discovered_wireless_iface == iiab_wireless_lan_iface + when: hostapd_enabled and not no_net_restart - name: Start named service systemd: From b1f6c8176e98fcf32d631c349e0d8b24fd39f9c2 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sun, 3 May 2020 19:18:20 -0500 Subject: [PATCH 3/6] for the most part restart dnsmasq --- roles/network/tasks/restart.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/roles/network/tasks/restart.yml b/roles/network/tasks/restart.yml index f75b27dae..6aa34c733 100644 --- a/roles/network/tasks/restart.yml +++ b/roles/network/tasks/restart.yml @@ -81,10 +81,13 @@ state: restarted when: hostapd_enabled and wifi_slave.stdout is defined and wifi_slave.stdout == 0 +#both interfaces.d and systemd-networkd should have br0 available and Appliance lacks br0 - name: User choice of dnsmasq or dhcpd - restarting {{ dhcp_service2 }} systemd: name: "{{ dhcp_service2 }}" state: restarted - when: not no_net_restart and discovered_wireless_iface == "none" + when: (not no_net_restart and not wifi_up_down) or wifi_up_down #when: (iiab_network_mode != "Appliance") # Sufficient b/c br0 exists thanks to /etc/network/interfaces.d/iiab #when: iiab_network_mode != "Appliance" and iiab_wan_iface != discovered_wireless_iface +#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 From 5c402848dd8bbd3bfb02c7efcf374a834a6a5ecd Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Mon, 4 May 2020 12:11:26 -0500 Subject: [PATCH 4/6] just restart systemd-networkd --- roles/network/tasks/sysd-netd-debian.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/roles/network/tasks/sysd-netd-debian.yml b/roles/network/tasks/sysd-netd-debian.yml index a1a904cfa..1b652e831 100644 --- a/roles/network/tasks/sysd-netd-debian.yml +++ b/roles/network/tasks/sysd-netd-debian.yml @@ -55,5 +55,3 @@ systemd: name: systemd-networkd state: restarted - #when: (netplan.stdout is undefined or netplan.stdout.find("yaml") == -1) and not no_net_restart - when: not no_net_restart From 9142cde8ff82310e4ff7777cb584f044e007e58b Mon Sep 17 00:00:00 2001 From: A Holt Date: Mon, 4 May 2020 15:32:34 -0400 Subject: [PATCH 5/6] Update roles/network/tasks/restart.yml --- roles/network/tasks/restart.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/network/tasks/restart.yml b/roles/network/tasks/restart.yml index 6aa34c733..c87609893 100644 --- a/roles/network/tasks/restart.yml +++ b/roles/network/tasks/restart.yml @@ -86,7 +86,7 @@ systemd: name: "{{ dhcp_service2 }}" state: restarted - when: (not no_net_restart and not wifi_up_down) or wifi_up_down + when: (not no_net_restart) or wifi_up_down #when: (iiab_network_mode != "Appliance") # Sufficient b/c br0 exists thanks to /etc/network/interfaces.d/iiab #when: iiab_network_mode != "Appliance" and iiab_wan_iface != discovered_wireless_iface #keep an eye on legacy wifi installs where br0 is present but not 'online' with an ip address From ffe33ac76dc588a370a5e9f4e9e6f70782061caa Mon Sep 17 00:00:00 2001 From: A Holt Date: Mon, 4 May 2020 15:32:43 -0400 Subject: [PATCH 6/6] Update roles/network/tasks/hostapd.yml --- roles/network/tasks/hostapd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/network/tasks/hostapd.yml b/roles/network/tasks/hostapd.yml index 5ce1ff2e2..8ecd42cd1 100644 --- a/roles/network/tasks/hostapd.yml +++ b/roles/network/tasks/hostapd.yml @@ -4,7 +4,7 @@ enabled: no masked: no -- name: Disable hostapd when not using ap0 and wifi gateway present or no WiFi hardware present +- name: Disable hostapd when not using ap0 and wifi gateway present, or no WiFi hardware present set_fact: hostapd_enabled: False when: (not wifi_up_down and discovered_wireless_iface == iiab_wan_iface) or discovered_wireless_iface == "none"