From 451dfa5133397669cd16419cbbb55e3df4e313b7 Mon Sep 17 00:00:00 2001 From: Gabriel Radureau Date: Sat, 3 Jan 2026 20:08:00 +0100 Subject: [PATCH] restart traefik when editing crowdsec middleware --- .../tools/roles/crowdsec/tasks/main.yml | 33 ++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/ansible/arcodange/factory/playbooks/tools/roles/crowdsec/tasks/main.yml b/ansible/arcodange/factory/playbooks/tools/roles/crowdsec/tasks/main.yml index 883383e..dcf8655 100644 --- a/ansible/arcodange/factory/playbooks/tools/roles/crowdsec/tasks/main.yml +++ b/ansible/arcodange/factory/playbooks/tools/roles/crowdsec/tasks/main.yml @@ -145,4 +145,35 @@ redisCacheEnabled: true redisCacheHost: "redis.tools:6379" redisCacheDatabase: "0" - redisCacheUnreachableBlock: false \ No newline at end of file + redisCacheUnreachableBlock: false + +- name: Redémarrer traefik pour prendre la nouvelle configuration du middleware + block: + # --------------------- + # Scale to 0 + # --------------------- + - name: Scale Traefik to 0 + kubernetes.core.k8s_scale: + api_version: apps/v1 + kind: Deployment + namespace: kube-system + name: traefik + replicas: 0 + rescue: + - name: Log failure + ansible.builtin.debug: + msg: "An error occurred during traefik scale down. Traefik will still be scaled back up." + + always: + # --------------------- + # Ensure Traefik is scaled back to 1 NO MATTER WHAT + # --------------------- + - name: Ensure Traefik is scaled back to 1 + kubernetes.core.k8s_scale: + api_version: apps/v1 + kind: Deployment + namespace: kube-system + name: traefik + replicas: 1 + wait: yes + wait_timeout: 300 \ No newline at end of file