2020-04-17 18:50:14 +02:00
|
|
|
---
|
2020-04-20 15:13:49 +02:00
|
|
|
- name: Check if the zabbix repository is installed
|
|
|
|
package_facts:
|
|
|
|
manager: "auto"
|
|
|
|
when:
|
|
|
|
- zabbix_agent_install | bool
|
|
|
|
tags: [ 'zabbix', 'zabbix_agent' ]
|
|
|
|
|
2020-04-17 18:50:14 +02:00
|
|
|
- import_tasks: zabbix-agent-deb.yml
|
|
|
|
when:
|
|
|
|
- zabbix_agent_install | bool
|
|
|
|
- ansible_distribution_file_variety == "Debian"
|
|
|
|
- import_tasks: zabbix-agent-rh.yml
|
|
|
|
when:
|
|
|
|
- ansible_distribution_file_variety == "RedHat"
|
|
|
|
- zabbix_agent_install | bool
|
2020-04-19 18:13:27 +02:00
|
|
|
- import_tasks: zabbix-agent_firewalld_rules.yml
|
|
|
|
when:
|
|
|
|
- ansible_distribution_file_variety == "RedHat"
|
|
|
|
- zabbix_agent_install | bool
|
|
|
|
|
|
|
|
- name: Manage the Zabbix agent configuration
|
|
|
|
block:
|
|
|
|
- name: Install the zabbix agent configuration file
|
|
|
|
template: src=zabbix_agentd.conf.j2 dest={{ zabbix_agent_conf_dir }}/zabbix_agentd.conf owner=root group=zabbix mode=0440
|
|
|
|
notify: restart zabbix-agent
|
|
|
|
|
|
|
|
- name: Install the zabbix PSK file
|
|
|
|
template: src=zabbix_agentd.psk.j2 dest={{ zabbix_agent_psk_file }} owner=root group=zabbix mode=0440
|
|
|
|
notify: restart zabbix-agent
|
|
|
|
when: zabbix_authentication_method == "psk"
|
|
|
|
|
|
|
|
when: zabbix_agent_install | bool
|
|
|
|
tags: [ 'zabbix', 'zabbix_agent', 'zabbix_agent_conf' ]
|
|
|
|
|
|
|
|
- name: Manage the Zabbix agent service
|
|
|
|
block:
|
|
|
|
- name: Ensure that the zabbix agent service is running and enabled
|
|
|
|
service: name=zabbix-agent state=started enabled=yes
|
|
|
|
|
|
|
|
when: zabbix_agent_install | bool
|
|
|
|
tags: [ 'zabbix', 'zabbix_agent', 'zabbix_agent_conf' ]
|