diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2023-09-23 00:46:31 +0200 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2023-09-23 10:15:05 +0200 |
commit | d51005bf38caf3b8c5a3334527b4ab34c8784a55 (patch) | |
tree | c2e48f5c6f3b07c178ba9e630e2fe4388792dfa2 /roles/linux_status/handlers/main.yml | |
parent | docker: avoid duplicate service restarts (diff) | |
download | infra-ansible-d51005bf38caf3b8c5a3334527b4ab34c8784a55.tar.gz infra-ansible-d51005bf38caf3b8c5a3334527b4ab34c8784a55.zip |
linux_status: get rid of unnecessary service restarts, etc.
Diffstat (limited to '')
-rw-r--r-- | roles/linux_status/handlers/main.yml | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/roles/linux_status/handlers/main.yml b/roles/linux_status/handlers/main.yml index 0ea529f..9c8b019 100644 --- a/roles/linux_status/handlers/main.yml +++ b/roles/linux_status/handlers/main.yml @@ -1,7 +1,18 @@ -- name: Restart linux-status +- name: Collect service facts + ansible.builtin.service_facts: + listen: linux_status_configured + +- name: Reload systemd daemon become: true ansible.builtin.systemd_service: daemon_reload: true + listen: linux_status_configured + +- name: Restart linux-status service + become: true + when: | + 'linux-status.service' in ansible_facts.services and ansible_facts.services['linux-status.service'].state == 'running' + ansible.builtin.systemd_service: name: linux-status state: restarted - listen: linux_status_restart + listen: linux_status_configured |