roles/zabbix-agent: Deploy Zabbix agent

The *zabbix-agent* role installs the Zabbix monitoring agent on the
managed node, and sets it up to communicate with the Zabbix server
specified by the `zabbix_server` variable. This role "should" be
compatible with most distributions; it has been tested with Fedora and
Gentoo.
This commit is contained in:
2018-04-14 15:27:02 -05:00
parent 3a7c9b52bf
commit 668b158cf9
8 changed files with 1037 additions and 0 deletions

View File

@@ -0,0 +1,47 @@
- name: load distribution-specifc values
include_vars: '{{ item }}'
with_first_found:
- '{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yml'
- '{{ ansible_distribution }}.yml'
- '{{ ansible_os_family }}.yml'
- defaults.yml
- name: ensure zabbix agent is installed
package:
name={{ zbx_agent_required_packages|join('') }}
state=present
tags:
- install
- name: ensure zabbix agent is configured
template:
src={{ zbx_agent_config_tmpl }}
dest={{ zbx_agent_config }}
mode=0644
notify: restart zabbix agent
- name: ensure zabbix agent config drop-in directory exists
file:
path={{ zbx_agent_config_dir }}
mode=0755
seuser=system_u
setype=etc_t
state=directory
- name: ensure zabbix is allowed in the firewall
firewalld:
port=10050/tcp
permanent=no
immediate=yes
state=enabled
tags:
- firewalld
notify: save firewalld configuration
- name: ensure zabbix agent starts at boot
service:
name={{ zbx_agent_svc }}
enabled=yes
- meta: flush_handlers
- name: ensure zabbix agent is running
service:
name={{ zbx_agent_svc }}
state=started