ctucx.git: ansible-configs

My personal ansible roles and playbooks

commit 1704e39513cde82e931623cb33f6a375da4440a7
parent 236bee37fa207e76514b4e010042a47f16ae732f
Author: Leah (ctucx) <leah@ctu.cx>
Date: Mon, 22 Feb 2021 17:02:17 +0100

roles/acme-redirect: some changes
3 files changed, 12 insertions(+), 17 deletions(-)
diff --git a/roles/acme-redirect/meta/main.yml b/roles/acme-redirect/meta/main.yml
@@ -1,4 +1,6 @@
 ---
 
 dependencies:
-  - nftables-handler-
\ No newline at end of file
+  - role: nftables-handler
+    when:
+      - network.nftables.enable is true
diff --git a/roles/acme-redirect/tasks/main.yml b/roles/acme-redirect/tasks/main.yml
@@ -33,3 +33,6 @@
   when:
     - services.acme_redirect.enable is defined
     - services.acme_redirect.enable is false
+
+- name: Run handlers
+  meta: flush_handlers+
\ No newline at end of file
diff --git a/roles/acme-redirect/tasks/remove.yml b/roles/acme-redirect/tasks/remove.yml
@@ -39,20 +39,10 @@
     - /etc/acme-redirect.d
     - /var/lib/acme-redirect
     - /etc/acme-redirect.conf
-    - /etc/nftables.d/acme-redirect.nft
 
-- name: "[OpenRC] Restart service: nftables"
-  service:
-    name: nftables
-    state: restarted
-  when:
-    - ansible_service_mgr == "openrc"
-    - network.nftables.enable is true
+- name: "[nftables] Delete rule for: acme-redirect"
+  file:
+    path: /etc/nftables.d/acme-redirect.nft
+    state: absent
+  notify: "Restart nftables"
 
-- name: "[systemd] Restart service: nftables"
-  systemd:
-    name: nftables
-    state: restarted
-  when:
-    - ansible_service_mgr == "systemd"
-    - network.nftables.enable is true