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