60 lines
1.4 KiB
YAML
60 lines
1.4 KiB
YAML
## Make sure to use an initrd providing firmware:
|
|
## wget https://cdimage.debian.org/cdimage/firmware/testing/current/firmware.cpio.gz
|
|
## cat initrd.gz firmware.cpio.gz > initrd-fw.gz
|
|
---
|
|
- name: Install packages related to iwd and wifi
|
|
ansible.builtin.apt:
|
|
name:
|
|
- iwd
|
|
- systemd-resolved
|
|
- firmware-realtek # for our wifi sticks
|
|
- rfkill
|
|
state: latest
|
|
|
|
- name: Disable wpa-supplicant
|
|
ansible.builtin.systemd:
|
|
name: wpa_supplicant.service
|
|
enabled: False
|
|
|
|
- name: Enable iwd
|
|
ansible.builtin.systemd:
|
|
name: iwd.service
|
|
enabled: True
|
|
|
|
- name: Prepare directory for iwd
|
|
file:
|
|
path: /var/lib/iwd/
|
|
state: directory
|
|
|
|
- name: Configure iwd for wifi device
|
|
ansible.builtin.copy:
|
|
dest: /var/lib/iwd/{{ ssid }}.psk
|
|
content: |
|
|
[Security]
|
|
Passphrase={{ wifipasswd }}
|
|
|
|
- name: Enable systemd-networkd
|
|
ansible.builtin.systemd:
|
|
name: systemd-networkd.service
|
|
enabled: True
|
|
|
|
|
|
- name: Provide service to enable WiFi on boot
|
|
ansible.builtin.copy:
|
|
dest: /etc/systemd/system/enable-wifi.service
|
|
content: |
|
|
[Unit]
|
|
Description=Switch WiFi on
|
|
|
|
[Service]
|
|
Type=oneshot
|
|
ExecStart=/usr/bin/rfkill enable wifi
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|
|
|
|
- name: Enable the enable-wifi service
|
|
ansible.builtin.systemd:
|
|
name: enable-wifi.service
|
|
enabled: True
|
|
daemon_reload: True
|