networking: suport both iwd and eiwd

This commit is contained in:
Hoang Nguyen 2022-11-20 19:05:41 +07:00
parent 72f10a2bdc
commit 330418490d
No known key found for this signature in database
GPG Key ID: 813CF484F4993419
3 changed files with 17 additions and 2 deletions

View File

@ -103,6 +103,9 @@ libvirt_daemons:
- virtqemud
- virtstoraged
# Whether to use `iwd` or `eiwd`
iwd_without_dbus: false
# Public facing network interfaces to configured
# (don't include wireless interfaces here as they should use dhcp with iwctl)
# https://wiki.alpinelinux.org/wiki/Configure_Networking

View File

@ -3,6 +3,16 @@
community.general.packaging.os.apk:
name: iwd
state: present
when: not iwd_without_dbus
# NOTE: connmanctl can't scan wifi with eiwd so we need iw
# - iw dev <interface> scan | grep SSID
# - printf <passphrase> | iwd_passphrase <ssid> > /var/lib/iwd/<ssid>.psk
- name: networking | Install eiwd and iw packages
community.general.packaging.os.apk:
name: eiwd, iw
state: present
when: iwd_without_dbus
- name: networking | Copy configuration
copy:
@ -13,8 +23,10 @@
mode: 0644
- name: networking | Start iwd service on runlevel 'default'
vars:
iwd_service: '{{ iwd_without_dbus | ternary("eiwd", "iwd") }}'
service:
name: iwd
name: '{{ iwd_service }}'
runlevel: default
enabled: true
state: started

View File

@ -1,5 +1,5 @@
---
- name: networking | Configure /etc/netconfig/interfaces
- name: networking | Configure /etc/network/interfaces
template:
src: interfaces.j2
dest: /etc/network/interfaces