Skip to content

Commit

Permalink
only reset a failed state if present to avoid an error
Browse files Browse the repository at this point in the history
  • Loading branch information
andanotheruser committed Nov 14, 2024
1 parent 17e8267 commit b41af34
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tasks/manage_node_state.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down

0 comments on commit b41af34

Please sign in to comment.