From 14b030a138732f1e910bad971f594e8fd5529a70 Mon Sep 17 00:00:00 2001 From: jerick Date: Mon, 16 Mar 2026 22:57:11 -0400 Subject: [PATCH] Changes for Service removal when uninstalling --- roles/zabbix_agent/tasks/main.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/roles/zabbix_agent/tasks/main.yml b/roles/zabbix_agent/tasks/main.yml index 0c578df..ee65c0d 100644 --- a/roles/zabbix_agent/tasks/main.yml +++ b/roles/zabbix_agent/tasks/main.yml @@ -83,6 +83,17 @@ purge: true when: zabbix_state == 'absent' +- name: Reload systemd to drop the removed unit file + ansible.builtin.systemd: + daemon_reload: true + when: zabbix_state == 'absent' + +- name: Clear any lingering systemd state for zabbix-agent2 + ansible.builtin.command: systemctl reset-failed zabbix-agent2 + when: zabbix_state == 'absent' + ignore_errors: true + changed_when: false + - name: Remove Zabbix configuration directory ansible.builtin.file: path: /etc/zabbix