added handler in case something in the config is changed, it will restart the service

This commit is contained in:
2026-03-17 15:41:38 -04:00
parent e42034488b
commit 379ab9e021
2 changed files with 10 additions and 0 deletions

View File

@@ -30,6 +30,7 @@
regexp: '^Server='
line: "Server={{ zabbix_server }}"
when: zabbix_state == 'present'
notify: Restart zabbix-agent2
- name: Configure Zabbix active server address
ansible.builtin.lineinfile:
@@ -37,6 +38,7 @@
regexp: '^ServerActive='
line: "ServerActive={{ zabbix_server }}"
when: zabbix_state == 'present'
notify: Restart zabbix-agent2
- name: Configure Zabbix agent hostname
ansible.builtin.lineinfile:
@@ -44,6 +46,7 @@
regexp: '^Hostname='
line: "Hostname={{ ansible_hostname }}"
when: zabbix_state == 'present'
notify: Restart zabbix-agent2
- name: Configure Zabbix agent listen IP
ansible.builtin.lineinfile:
@@ -51,6 +54,7 @@
regexp: '^#?ListenIP='
line: "ListenIP=127.0.0.1"
when: zabbix_state == 'present'
notify: Restart zabbix-agent2
- name: Enable and start Zabbix agent2
ansible.builtin.systemd: