From b41af348d5136603c45eaebe1e4969574b4abab5 Mon Sep 17 00:00:00 2001 From: Joshua Hoffmann Date: Thu, 14 Nov 2024 12:45:32 +0100 Subject: [PATCH] only reset a failed state if present to avoid an error --- tasks/manage_node_state.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tasks/manage_node_state.yml b/tasks/manage_node_state.yml index c8e8369..ae49acf 100644 --- a/tasks/manage_node_state.yml +++ b/tasks/manage_node_state.yml @@ -6,6 +6,9 @@ become: true when: inventory_hostname == item +- name: manage_node_state | Populate service facts + ansible.builtin.service_facts: + - name: manage_node_state | reset failed status (otherwise service can't be stopped) command: "systemctl reset-failed {{ mariadb_systemd_service_name }}" # noqa command-instead-of-module become: true @@ -14,6 +17,7 @@ when: - '"stopped" in mariadb_systemd_service_state' - inventory_hostname == item + - '"failed" in ansible_facts.services[mariadb_systemd_service_name].state' - name: manage_node_state | ensure node is fully stopped before continuing ansible.builtin.service: