Zabbix: Make agent service handler global
We have some hosts that do not include the zabbix_agent role which means they cannot find the restart handler for things like the postfix monitoring - and even then the restart would fail because the agent service doesn't exist This adds a global handler that is allowed to fail if the service is missing, but otherwise should fail normally for other problems This can probably be changed once we have zabbix everywhere... Signed-off-by: Greg Sutcliffe <fedora@emeraldreverie.org>
This commit is contained in:
parent
f1213c4af8
commit
4d0a89d1fd
2 changed files with 11 additions and 3 deletions
|
|
@ -185,3 +185,14 @@
|
|||
|
||||
- name: Restart debuginfod
|
||||
service: name=debuginfod state=restarted
|
||||
|
||||
# This is allowed to fail when the zabbix agent is not found
|
||||
# as it may be triggered from hosts without the zabbix_agent role
|
||||
- name: Restart zabbix agent
|
||||
ansible.builtin.systemd:
|
||||
name: zabbix-agent
|
||||
state: restarted
|
||||
register: zabbix_restart
|
||||
failed_when:
|
||||
- zabbix_restart.failed
|
||||
- "'Could not find' not in zabbix_restart.msg"
|
||||
|
|
|
|||
|
|
@ -1,7 +1,4 @@
|
|||
---
|
||||
- name: Restart zabbix agent
|
||||
service: name=zabbix-agent state=restarted
|
||||
|
||||
- name: Reload custom selinux files
|
||||
ansible.builtin.shell: /usr/sbin/semodule -u "/etc/selinux/centos/centos-zabbix-agent.pp"
|
||||
when: ansible_selinux.mode == "enforcing"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue