diff options
| author | Ahmed Abdelhalim <[email protected]> | 2026-02-26 20:17:35 +0100 |
|---|---|---|
| committer | Ahmed Abdelhalim <[email protected]> | 2026-02-26 21:32:50 +0100 |
| commit | 9b5fd8907d839f59b5a0de3b25056a64366b0b15 (patch) | |
| tree | 997ff4fca43fcb1b256c69ffd276690a1cb4b58d /roles/network/tasks | |
| parent | 8eb1bb1bdafa4fa539e179758769324dad6674b4 (diff) | |
Fix auto-starting iwd on boot
Diffstat (limited to 'roles/network/tasks')
| -rw-r--r-- | roles/network/tasks/main.yml | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/roles/network/tasks/main.yml b/roles/network/tasks/main.yml index 394ec688..a2358fe6 100644 --- a/roles/network/tasks/main.yml +++ b/roles/network/tasks/main.yml @@ -55,6 +55,16 @@ when: ansible_facts['is_chroot'] # noqa: command-instead-of-module module doesn't work inside chroot +- name: "Compute hex-encoded SSID for iwd filename" + # noqa: risky-shell-pipe since this is used early before bash configuration + # it is the exception and needed to ensure that iwd is working on Mac machines + # that only work with broadcom-wl and iwd + ansible.builtin.shell: + cmd: "printf '%s' '{{ network_wifi_ssid }}' | xxd -p | tr -d '\\n'" + register: network_wifi_hex_ssid + changed_when: false + when: network_wifi_ssid != "" + - name: "Configure NetworkManager" become: true notify: @@ -98,3 +108,21 @@ owner: "root" group: "root" when: network_wifi_ssid != "" + + - name: "Ensure /var/lib/iwd directory exists" + ansible.builtin.file: + path: "/var/lib/iwd" + state: "directory" + mode: "0700" + owner: "root" + group: "root" + when: network_wifi_ssid != "" + + - name: "Configure iwd known network for wifi auto-connect" + ansible.builtin.template: + src: "iwd-wifi.psk.j2" + dest: "/var/lib/iwd/={{ network_wifi_hex_ssid.stdout }}.psk" + mode: "0600" + owner: "root" + group: "root" + when: network_wifi_ssid != "" |
