1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-03-09 15:40:17 +00:00

hostapd refinement

This commit is contained in:
Jerry Vonau 2022-07-19 00:49:28 -05:00
parent 85a5f8fd98
commit 861652f141

View file

@ -1,13 +1,14 @@
- name: Disable the Access Point 'hostapd' service
systemd:
name: hostapd
enabled: no
- name: Disable hostapd when not using ap0 and wifi gateway present, or no WiFi hardware present or support not detected
set_fact:
hostapd_enabled: False
when: (not wifi_up_down and discovered_wireless_iface == iiab_wan_iface) or discovered_wireless_iface == "none" or not can_be_ap
- name: Disable the Access Point 'hostapd' service
systemd:
name: hostapd
enabled: no
when: not hostapd_enabled
- name: Detect current Wifi channel
shell: iw {{ discovered_wireless_iface }} info | grep channel | cut -d' ' -f2
register: current_client_channel
@ -21,10 +22,12 @@
- name: Generate new random mac address for ap0
shell: tr -dc A-F0-9 < /dev/urandom | head -c 10 | sed -r 's/(..)/\1:/g;s/:$//;s/^/02:/'
register: ap0_mac
when: can_be_ap
- name: Setting ap0 mac address for use in hostapd service file
set_fact:
ap0_mac_addr: "{{ ap0_mac.stdout }}"
when: can_be_ap
- name: "Use custom 'hostapd' systemd service unit file using ap0 -- install from template: /etc/systemd/system/hostapd.service, /etc/systemd/system/iiab-clone-wifi.service, /etc/systemd/system/iiab-wifi-test.service, /usr/sbin/iiab-test-wifi"
template: