2023-10-23 15:14:16 +00:00
|
|
|
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
|
|
# Install and configure ZABBIX AGENT
|
|
|
|
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
|
|
|
2024-02-15 16:46:14 +00:00
|
|
|
- name: "[CONFIG ZABBIX AGENT] Comprobando si es necesario configurar ZABBIX AGENT"
|
|
|
|
meta: end_host
|
2024-02-15 17:50:53 +00:00
|
|
|
when: zabbix_agent_enabled is not defined or not zabbix_agent_enabled
|
2024-02-15 16:46:14 +00:00
|
|
|
|
2023-10-23 15:14:16 +00:00
|
|
|
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
|
|
# Paso1
|
|
|
|
# Download zabbix repository
|
2023-10-31 12:22:06 +00:00
|
|
|
#- name: Download deb package
|
|
|
|
# get_url:
|
|
|
|
# url: "{{ deb_url }}"
|
|
|
|
# dest: /tmp/"{{ deb_package_repo }}"
|
|
|
|
# Copiar el fichero deb
|
|
|
|
- name: copy zabbix deb
|
|
|
|
copy:
|
|
|
|
src: "{{deb_package_repo}}"
|
2023-10-31 12:27:17 +00:00
|
|
|
dest: /tmp/{{deb_package_repo}}
|
2023-10-31 12:22:06 +00:00
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: '0644'
|
2023-10-23 15:14:16 +00:00
|
|
|
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
|
|
# Paso2
|
|
|
|
# Install zabbix repository
|
|
|
|
- name: Install zabbix repository
|
|
|
|
apt:
|
2023-10-30 11:54:06 +00:00
|
|
|
deb: /tmp/{{ deb_package_repo }}
|
2023-10-23 15:14:16 +00:00
|
|
|
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
|
|
# Paso3
|
|
|
|
# Delete deb package from tmp
|
|
|
|
- name: Delete deb package from tmp
|
|
|
|
file:
|
2023-10-30 11:54:06 +00:00
|
|
|
path: /tmp/{{ deb_package_repo }}
|
2023-10-23 15:14:16 +00:00
|
|
|
state: absent
|
|
|
|
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
|
|
# Paso4
|
|
|
|
# update packages
|
|
|
|
- name: update packages
|
|
|
|
apt:
|
2024-02-15 18:11:21 +00:00
|
|
|
# name: "*" # no necesita 'apt upgrade' , solo 'apt update'
|
|
|
|
# state: latest # no necesita 'apt upgrade' , solo 'apt update'
|
2023-10-23 15:14:16 +00:00
|
|
|
update_cache: true
|
|
|
|
force_apt_get: true
|
|
|
|
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
|
|
# Install zabbix agent
|
|
|
|
- name: Install zabbix agent
|
|
|
|
apt:
|
|
|
|
name: "{{ zabbix_package }}"
|
|
|
|
state: present
|
|
|
|
notify: restart zabbix-agent
|
|
|
|
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
|
|
# service should start on boot.
|
|
|
|
- name: service should start on boot
|
|
|
|
service:
|
|
|
|
name: "{{ zabbix_agent_daemon }}"
|
|
|
|
enabled: yes
|
|
|
|
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|