Files
configpolicy/roles/zabbix-agent/tasks/main.yml
Dustin C. Hatch f78fe14eae roles/zabbix: Respect host_uses_firewalld
For machines that do not use firewalld, the *zabbix-agent* role will now
skip attempting to open the Zabbix agent port using the `firewalld`
module. The `host_uses_firewalld` variable controls this behavior.
2018-06-19 20:37:09 -05:00

49 lines
1.2 KiB
YAML

- 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
when: host_uses_firewalld|d(true)
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