zabbix/tasks/install_agent.yml

66 lines
1.5 KiB
YAML

---
- name: '[Agent] - Install Zabbix from repository'
apt:
name: '{{ zabbix_agent_pkg }}'
update_cache: true
install_recommends: false
cache_valid_time: '3600'
notify:
- 'Restart zabbix_agent'
tags:
- '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'
owner: 'root'
group: 'root'
mode: '0755'
notify:
- 'Restart zabbix_agent'
tags:
- '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'
tags:
- 'agent'
- name: '[Agent] - Ensure config dir path exists'
file:
path: '{{ zabbix_agent_scripts_config_path }}'
state: 'directory'
owner: 'root'
group: 'root'
mode: '0755'
tags:
- 'agent'
- name: '[Agent] - Configure scripts'
template:
src: 'zabbix-scripts.cfg.j2'
dest: '{{ zabbix_agent_scripts_config_path }}/zabbix-scripts.cfg'
owner: 'root'
group: 'root'
mode: '0755'
when: zabbix_scripts_deploy == 'true'
notify:
- 'Restart zabbix_agent'
tags:
- 'agent'
- name: '[Agent] - Make sure the service is enabled'
systemd:
name: 'zabbix-agent'
enabled: true
tags:
- 'agent'