From 86c47eec4f9e6fd8c32267a09653101a73d2779e Mon Sep 17 00:00:00 2001 From: "noussair.hamrit" Date: Thu, 29 Oct 2026 10:05:38 +0100 Subject: [PATCH] fix(ansible): apply private VPN routes before verification --- roles/private_routing/handlers/main.yml | 10 ---------- roles/private_routing/tasks/main.yml | 13 +++++++++++-- 2 files changed, 11 insertions(+), 12 deletions(-) delete mode 100644 roles/private_routing/handlers/main.yml diff --git a/roles/private_routing/handlers/main.yml b/roles/private_routing/handlers/main.yml deleted file mode 100644 index bf8e30d..0000000 --- a/roles/private_routing/handlers/main.yml +++ /dev/null @@ -1,10 +0,0 @@ ---- -- name: Apply private VPN route - ansible.builtin.command: netplan apply - changed_when: false - when: private_routing_netplan_files.matched | default(0) > 0 -- name: Reload systemd-networkd routes - ansible.builtin.systemd: - name: systemd-networkd - state: restarted - when: private_routing_netplan_files.matched | default(0) == 0 diff --git a/roles/private_routing/tasks/main.yml b/roles/private_routing/tasks/main.yml index 8bba095..fde1b38 100644 --- a/roles/private_routing/tasks/main.yml +++ b/roles/private_routing/tasks/main.yml @@ -40,7 +40,11 @@ mode: "0600" validate: python3 -c "import yaml,sys; yaml.safe_load(open(sys.argv[1]))" %s when: private_routing_netplan_files.matched | default(0) > 0 - notify: Apply private VPN route + +- name: Apply Netplan route configuration + ansible.builtin.command: netplan apply + changed_when: false + when: private_routing_netplan_files.matched | default(0) > 0 - name: Install systemd-networkd route drop-in ansible.builtin.copy: @@ -57,7 +61,12 @@ group: root mode: "0644" when: private_routing_netplan_files.matched | default(0) == 0 - notify: Apply private VPN route + +- name: Apply systemd-networkd route configuration + ansible.builtin.systemd: + name: systemd-networkd + state: restarted + when: private_routing_netplan_files.matched | default(0) == 0 - name: Verify selected route to internet ansible.builtin.command: ip -4 route get 8.8.8.8