From 96d62d606011286f803c4cd2d8d69c5ca5820014 Mon Sep 17 00:00:00 2001 From: dogeystamp Date: Tue, 2 Jan 2024 21:03:31 -0500 Subject: [PATCH] add wifi "support" --- group_vars/all/00-secret_template.yml | 3 +++ roles/containers/templates/docker-compose.yml.j2 | 1 + roles/networking/connection/defaults/main.yml | 9 +++++++++ roles/networking/connection/tasks/main.yml | 13 +++++++++++-- .../connection/templates/mac-randomization.conf.j2 | 2 ++ roles/networking/connection/templates/rmconn.sh | 6 +++--- 6 files changed, 29 insertions(+), 5 deletions(-) create mode 100644 roles/networking/connection/templates/mac-randomization.conf.j2 diff --git a/group_vars/all/00-secret_template.yml b/group_vars/all/00-secret_template.yml index a3d0589..e7e72c8 100644 --- a/group_vars/all/00-secret_template.yml +++ b/group_vars/all/00-secret_template.yml @@ -1,5 +1,8 @@ --- +# password for wifi, if applicable +conn_pass: "" + # password for ddclient ddclient_pass: "" diff --git a/roles/containers/templates/docker-compose.yml.j2 b/roles/containers/templates/docker-compose.yml.j2 index 381f6f0..34fb900 100644 --- a/roles/containers/templates/docker-compose.yml.j2 +++ b/roles/containers/templates/docker-compose.yml.j2 @@ -120,6 +120,7 @@ services: PAPERLESS_URL: "https://{{ paperless_domain }}" PAPERLESS_USE_X_FORWARD_HOST: true PAPERLESS_USE_X_FORWARD_PORT: true + PAPERLESS_OCR_USER_ARGS: '{"continue_on_soft_render_error": true}' PAPERLESS_OCR_PAGES: 1 PAPERLESS_TASK_WORKERS: 2 PAPERLESS_THREADS_PER_WORKER: 2 diff --git a/roles/networking/connection/defaults/main.yml b/roles/networking/connection/defaults/main.yml index 4400efc..32c2324 100644 --- a/roles/networking/connection/defaults/main.yml +++ b/roles/networking/connection/defaults/main.yml @@ -3,6 +3,15 @@ # static IP interface net_interface: eth0 +# e.g. wifi +conn_type: ethernet +# if you have a wireless connection already, set this to its name to use it +conn_name: wired +# wifi connection name +conn_ssid: "" +# set this in the secret template +conn_pass: "" + # LAN static IP address local_ip: null subnet_prefix: /24 diff --git a/roles/networking/connection/tasks/main.yml b/roles/networking/connection/tasks/main.yml index 1871685..0bcede6 100644 --- a/roles/networking/connection/tasks/main.yml +++ b/roles/networking/connection/tasks/main.yml @@ -3,6 +3,11 @@ name: - networkmanager +- name: Disable MAC randomization + template: + src: mac-randomization.conf.j2 + dest: /etc/systemd/resolved.conf.d/30-mac-randomization.conf + - name: Enable NetworkManager service: name: NetworkManager @@ -68,9 +73,13 @@ gw4: "{{ gateway }}" method4: manual state: present - conn_name: wired + conn_name: "{{ conn_name }}" + ssid: "{{ conn_ssid }}" + wifi_sec: + key-mgmt: wpa-psk + psk: "{{ conn_pass }}" ifname: "{{ net_interface }}" - type: ethernet + type: "{{ conn_type }}" register: nmcli_conf changed_when: false poll: 0 diff --git a/roles/networking/connection/templates/mac-randomization.conf.j2 b/roles/networking/connection/templates/mac-randomization.conf.j2 new file mode 100644 index 0000000..b521193 --- /dev/null +++ b/roles/networking/connection/templates/mac-randomization.conf.j2 @@ -0,0 +1,2 @@ +[device-mac-randomization] +wifi.scan-rand-mac-address=no diff --git a/roles/networking/connection/templates/rmconn.sh b/roles/networking/connection/templates/rmconn.sh index 01543af..9677013 100644 --- a/roles/networking/connection/templates/rmconn.sh +++ b/roles/networking/connection/templates/rmconn.sh @@ -3,6 +3,6 @@ sleep 30 /usr/bin/nmcli connection down {{ net_interface }} > /dev/null 2>&1 -/usr/bin/nmcli connection down "Wired connection 1" > /dev/null 2>&1 -/usr/bin/nmcli connection down wired > /dev/null 2>&1 -/usr/bin/nmcli connection up wired > /dev/null +/usr/bin/nmcli connection down "Wired connection 1" > /dev/null 2>&1 +/usr/bin/nmcli connection down {{ conn_name }} > /dev/null 2>&1 +/usr/bin/nmcli connection up {{ conn_name }} > /dev/null