From b46bf38e84b3abbb0e21491247d1b3cd6938da64 Mon Sep 17 00:00:00 2001 From: Martin Kennedy Date: Sat, 6 Aug 2022 22:51:11 -0400 Subject: [PATCH] feat: Configure network-specific packages This is probably not the right way to do this ... but it's tricky. Packages that are REQUIRED for proper network config need to be handled somewhere before we do network config. Perhaps this could be moved to the netconfig role on its own, but I don't really want to try. --- inventory.yml | 31 +++++++++++++++++++++------- roles/netpkgconfig/handlers/main.yml | 9 ++++++++ roles/netpkgconfig/meta/main.yml | 2 ++ roles/netpkgconfig/tasks/main.yml | 13 ++++++++++++ wireless-setup.yml | 1 + 5 files changed, 48 insertions(+), 8 deletions(-) create mode 100644 roles/netpkgconfig/handlers/main.yml create mode 100644 roles/netpkgconfig/meta/main.yml create mode 100644 roles/netpkgconfig/tasks/main.yml diff --git a/inventory.yml b/inventory.yml index ecf46ca..d9cb5ae 100644 --- a/inventory.yml +++ b/inventory.yml @@ -1,15 +1,30 @@ +templates: + package_ath10k_mesh: &package_ath10k_mesh + - name: kmod-ath10k-ct + state: absent + - name: ath10k-firmware-qca988x-ct + state: absent + - name: kmod-ath10k + state: present + - name: ath10k-firmware-qca988x + state: present + + package_wpad_mesh: &package_wpad_mesh + - name: wpad-basic-wolfssl + state: absent + - name: wpad-mesh-wolfssl + state: absent + - name: wpad-wolfssl + state: present + notify: + - Reload wpad + openwrt: hosts: ap3825i2.lan: packages: - - name: kmod-ath10k-ct - state: absent - - name: ath10k-firmware-qca988x-ct - state: absent - - name: kmod-ath10k - state: present - - name: ath10k-firmware-qca988x - state: present + ath10k: *package_ath10k_mesh + wpad: *package_wpad_mesh network: device: diff --git a/roles/netpkgconfig/handlers/main.yml b/roles/netpkgconfig/handlers/main.yml new file mode 100644 index 0000000..dd390e9 --- /dev/null +++ b/roles/netpkgconfig/handlers/main.yml @@ -0,0 +1,9 @@ +- name: Reload wpad + nohup: + command: "wifi down; /etc/init.d/wpad restart; wifi up" + +- name: Touch a file + command: + argv: + - touch + - /tmp/test_proof diff --git a/roles/netpkgconfig/meta/main.yml b/roles/netpkgconfig/meta/main.yml new file mode 100644 index 0000000..8cc4ed6 --- /dev/null +++ b/roles/netpkgconfig/meta/main.yml @@ -0,0 +1,2 @@ +dependencies: + - role: gekmihesg.openwrt diff --git a/roles/netpkgconfig/tasks/main.yml b/roles/netpkgconfig/tasks/main.yml new file mode 100644 index 0000000..b5c3be0 --- /dev/null +++ b/roles/netpkgconfig/tasks/main.yml @@ -0,0 +1,13 @@ +- name: Install the correct wpad packages + opkg: + name: "{{ item.name }}" + state: "{{ item.state }}" + loop: "{{ packages.wpad | default([]) }}" + notify: "{{ item.notify | default([]) }}" + +- name: Install the correct ath10k packages + opkg: + name: "{{ item.name }}" + state: "{{ item.state }}" + loop: "{{ packages.ath10k | default([]) }}" + notify: "{{ item.notify | default([]) }}" diff --git a/wireless-setup.yml b/wireless-setup.yml index 31e041d..b164981 100644 --- a/wireless-setup.yml +++ b/wireless-setup.yml @@ -1,3 +1,4 @@ - hosts: openwrt roles: + - netpkgconfig - netconfig