zabbix/tasks/install_agent.yml

47 lines
1.2 KiB
YAML

---
- name: "[Agent] - Install Zabbix from repository"
apt:
name: "{{ zabbix_agent_pkg }}"
state: latest
update_cache: yes
install_recommends: no
cache_valid_time: 3600
notify:
- restart zabbix_agent
- name: "[Agent] - Deploy Zabbix custom userparameters"
template:
src: 'templates/etc/zabbix/zabbix_agent.d/userparameter_container.conf.j2'
dest: '/etc/zabbix/zabbix_agentd.d/userparameter_container.conf'
notify:
- restart zabbix_agent
- name: "[Agent] - Deploy Zabbix scripts"
git:
repo: '{{ zabbix_scripts_repo }}'
dest: '{{ zabbix_scripts_dir }}'
force: 'yes'
version: '{{ zabbix_scripts_version }}'
when: zabbix_scripts_deploy == 'true'
notify:
- restart zabbix_agent
- name: '[Agent] - Ensure config dir path exists'
file:
path: '/var/local/container-scripts'
state: 'directory'
mode: '0755'
- name: "[Agent] - Configure scripts"
template:
src: 'zabbix-scripts.cfg.j2'
dest: '/var/local/container-scripts/zabbix-scripts.cfg'
when: zabbix_scripts_deploy == 'true'
notify:
- restart zabbix_agent
- name: "[Agent] - Make sure the service is enabled"
systemd:
name: zabbix-agent
enabled: yes