vn-ansible/roles/config-zabbix-agent/tasks/main.yaml

59 lines
2.0 KiB
YAML

#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Install and configure ZABBIX AGENT
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- name: "[CONFIG ZABBIX AGENT] Comprobando si es necesario configurar ZABBIX AGENT"
meta: end_host
when: zabbix_agent_enabled is not defined or not zabbix_agent_enabled
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Paso1
# Download zabbix repository
#- 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}}"
dest: /tmp/{{deb_package_repo}}
owner: root
group: root
mode: '0644'
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Paso2
# Install zabbix repository
- name: Install zabbix repository
apt:
deb: /tmp/{{ deb_package_repo }}
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Paso3
# Delete deb package from tmp
- name: Delete deb package from tmp
file:
path: /tmp/{{ deb_package_repo }}
state: absent
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Paso4
# update packages
- name: update packages
apt:
# name: "*" # no necesita 'apt upgrade' , solo 'apt update'
# state: latest # no necesita 'apt upgrade' , solo 'apt update'
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
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++