mirror of
https://github.com/iiab/iiab.git
synced 2025-03-09 15:40:17 +00:00
Merge pull request #2383 from jvonau/2382
2382 [hostapd / restart / dnsmasq / systemd-networkd refinement]
This commit is contained in:
commit
25b503adc9
3 changed files with 13 additions and 7 deletions
|
@ -4,10 +4,10 @@
|
||||||
enabled: no
|
enabled: no
|
||||||
masked: 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:
|
set_fact:
|
||||||
hostapd_enabled: False
|
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
|
- name: Detect current Wifi channel
|
||||||
shell: iw {{ discovered_wireless_iface }} info | grep channel | cut -d' ' -f2
|
shell: iw {{ discovered_wireless_iface }} info | grep channel | cut -d' ' -f2
|
||||||
|
|
|
@ -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:
|
systemd:
|
||||||
name: hostapd
|
name: hostapd
|
||||||
state: restarted
|
state: restarted
|
||||||
# when: iiab_wireless_lan_iface is defined and hostapd_enabled and discovered_wireless_iface != iiab_wan_iface
|
# 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
|
- name: Start named service
|
||||||
systemd:
|
systemd:
|
||||||
|
@ -76,10 +81,13 @@
|
||||||
state: restarted
|
state: restarted
|
||||||
when: hostapd_enabled and wifi_slave.stdout is defined and wifi_slave.stdout == 0
|
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 }}
|
- name: User choice of dnsmasq or dhcpd - restarting {{ dhcp_service2 }}
|
||||||
systemd:
|
systemd:
|
||||||
name: "{{ dhcp_service2 }}"
|
name: "{{ dhcp_service2 }}"
|
||||||
state: restarted
|
state: restarted
|
||||||
when: not no_net_restart and discovered_wireless_iface == "none"
|
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") # Sufficient b/c br0 exists thanks to /etc/network/interfaces.d/iiab
|
||||||
#when: iiab_network_mode != "Appliance" and iiab_wan_iface != discovered_wireless_iface
|
#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
|
||||||
|
|
|
@ -55,5 +55,3 @@
|
||||||
systemd:
|
systemd:
|
||||||
name: systemd-networkd
|
name: systemd-networkd
|
||||||
state: restarted
|
state: restarted
|
||||||
#when: (netplan.stdout is undefined or netplan.stdout.find("yaml") == -1) and not no_net_restart
|
|
||||||
when: not no_net_restart
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue