diff --git a/roles/network/tasks/hostapd.yml b/roles/network/tasks/hostapd.yml index 9eba9d159..8ac825472 100644 --- a/roles/network/tasks/hostapd.yml +++ b/roles/network/tasks/hostapd.yml @@ -21,6 +21,14 @@ mode: 0644 when: discovered_wireless_iface != "none" +- 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 + +- name: Setting ap0 mac address for use in hostapd service file + set_fact: + ap0_mac_addr: "{{ ap0_mac.stdout }}" + - name: Use custom systemd unit file to start 'hostapd' service template: src: hostapd/hostapd.service.j2