Implement systemd-networkd and iwd for WLAN connection.
This commit is contained in:
parent
7dfe195716
commit
a057159c24
4 changed files with 62 additions and 1 deletions
|
@ -159,5 +159,6 @@
|
|||
localuser: "{{ vault_localuser }}"
|
||||
localuser_pwd: "{{ vault_localuser_pwd }}"
|
||||
roles:
|
||||
- lmn_wlan
|
||||
- role: lmn_wlan_iwd
|
||||
when: ansible_interfaces | select('search', 'wl.+') | first is defined
|
||||
- lmn_localuser
|
||||
|
|
60
roles/lmn_wlan_iwd/tasks/main.yml
Normal file
60
roles/lmn_wlan_iwd/tasks/main.yml
Normal file
|
@ -0,0 +1,60 @@
|
|||
## 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 iwd
|
||||
ansible.builtin.apt:
|
||||
name:
|
||||
- iwd
|
||||
- systemd-resolved
|
||||
state: latest
|
||||
|
||||
- name: Disable wpa-supplicant
|
||||
ansible.builtin.systemd:
|
||||
name: wpa_supplicant.service
|
||||
state: stopped
|
||||
enabled: False
|
||||
|
||||
- name: Enable iwd
|
||||
ansible.builtin.systemd:
|
||||
name: iwd.service
|
||||
state: started
|
||||
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: Use iwd but ignore wlan interfaces in NetworkManager
|
||||
blockinfile:
|
||||
dest: /etc/NetworkManager/NetworkManager.conf
|
||||
block: |
|
||||
[device]
|
||||
wifi.backend=iwd
|
||||
match-device=interface-name:wl*
|
||||
managed=0
|
||||
|
||||
- name: Configure systemd-networkd
|
||||
ansible.builtin.copy:
|
||||
dest: /etc/systemd/network/wlan-dhcp.network
|
||||
content: |
|
||||
[Match]
|
||||
Name=wl*
|
||||
[Network]
|
||||
DHCP=yes
|
||||
[DHCPv4]
|
||||
UseDomains=true
|
||||
|
||||
- name: Enable systemd-networkd
|
||||
ansible.builtin.systemd:
|
||||
name: systemd-networkd.service
|
||||
state: started
|
||||
enabled: True
|
Loading…
Add table
Reference in a new issue