added handler in case something in the config is changed, it will restart the service
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user