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

55 lines
1.7 KiB
YAML
Raw Normal View History

2023-10-23 15:14:16 +00:00
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Install and configure ZABBIX AGENT
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# 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:
name: "*"
state: latest
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
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++