2023-08-22 09:19:33 +00:00
|
|
|
---
|
2023-08-22 09:23:13 +00:00
|
|
|
- hosts: "{{ hosts_servers }}"
|
2023-08-22 09:54:02 +00:00
|
|
|
gather_facts: no
|
|
|
|
|
2023-08-22 09:19:33 +00:00
|
|
|
tasks:
|
|
|
|
- name: gather os specific variables
|
|
|
|
include_vars: "{{ item }}"
|
|
|
|
with_first_found:
|
2023-08-22 09:48:42 +00:00
|
|
|
- "Debian.yaml"
|
2023-08-22 09:19:33 +00:00
|
|
|
|
|
|
|
- name: Download zabbix repo package
|
|
|
|
get_url:
|
|
|
|
url: "{{ zabbix_repo_url}}"
|
|
|
|
dest: /tmp/zabbix.deb
|
|
|
|
|
|
|
|
- name: Install zabbix repo
|
|
|
|
become: yes
|
|
|
|
apt:
|
|
|
|
deb: /tmp/zabbix.deb
|
|
|
|
state: present
|
|
|
|
|
|
|
|
- name: Install zabbix agent
|
|
|
|
become: yes
|
|
|
|
apt:
|
|
|
|
name: zabbix-agent
|
|
|
|
state: present
|
|
|
|
update_cache: yes
|
|
|
|
|
|
|
|
- name: Stop service zabbix-agent
|
|
|
|
become: yes
|
|
|
|
service:
|
|
|
|
name: zabbix-agent
|
|
|
|
state: stopped
|
|
|
|
|
|
|
|
- name: Remove zabbix config file
|
|
|
|
become: yes
|
|
|
|
file:
|
|
|
|
path: /etc/zabbix/zabbix_agentd.conf
|
|
|
|
state: absent
|
|
|
|
|
|
|
|
- name: Create new zabbix config file from template
|
|
|
|
become: yes
|
|
|
|
template:
|
2023-08-22 09:51:07 +00:00
|
|
|
src: "zabbix_agentd.conf.j2"
|
2023-08-22 09:19:33 +00:00
|
|
|
dest: "/etc/zabbix/zabbix_agentd.conf"
|
|
|
|
|
|
|
|
- name: Start service zabbix-agent
|
|
|
|
become: yes
|
|
|
|
service:
|
|
|
|
name: zabbix-agent
|
|
|
|
state: started
|