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

supply hostapd template later to pickup changed fact

This commit is contained in:
Jerry Vonau 2022-04-14 09:09:27 -05:00
parent 422b1c0197
commit 4a30d7e15d
4 changed files with 18 additions and 24 deletions

View file

@ -19,18 +19,6 @@
host_channel: "{{ current_client_channel.stdout }}"
when: current_client_channel.stdout is defined and current_client_channel.stdout != "" and current_client_channel.stdout|int <= 13
- name: Create /etc/hostapd/hostapd.conf and backup .iiab from template
template:
owner: root
group: root
mode: 0644
src: "{{ item.src }}"
dest: "{{ item.dest }}"
with_items:
- { src: 'hostapd/hostapd.conf.j2', dest: '/etc/hostapd/hostapd.conf' }
- { src: 'hostapd/hostapd.conf.j2', dest: '/etc/hostapd/hostapd.conf.iiab' }
when: can_be_ap
- 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

View file

@ -6,6 +6,24 @@
- wpa_supplicant
when: wifi_up_down and hostapd_enabled
- name: Create /etc/hostapd/hostapd.conf and backup .iiab from template if needed
template:
owner: root
group: root
mode: 0644
src: "{{ item.src }}"
dest: "{{ item.dest }}"
with_items:
- { src: 'hostapd/hostapd.conf.j2', dest: '/etc/hostapd/hostapd.conf' }
- { src: 'hostapd/hostapd.conf.j2', dest: '/etc/hostapd/hostapd.conf.iiab' }
when: can_be_ap
- name: Restart hostapd when WiFi is present but not when using WiFi as gateway with wifi_up_down False
systemd:
name: hostapd
state: restarted
when: hostapd_enabled and (wifi_up_down or not no_net_restart)
- 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

View file

@ -76,12 +76,6 @@
state: restarted
when: iiab_wired_lan_iface is defined
- name: Restart hostapd when WiFi is present but not when using WiFi as gateway with wifi_up_down False
systemd:
name: hostapd
state: restarted
when: hostapd_enabled and (wifi_up_down or not no_net_restart)
#- name: Stop wpa_supplicant on Raspbian
# shell: killall wpa_supplicant

View file

@ -70,9 +70,3 @@
state: restarted
enabled: yes
masked: no
- name: Restart hostapd when WiFi is present but not when using WiFi as gateway with wifi_up_down False
systemd:
name: hostapd
state: restarted
when: hostapd_enabled and (wifi_up_down or not no_net_restart)