playbook and roles for zabbix-agent

This commit is contained in:
Ruben Blanco 2023-10-23 17:14:16 +02:00
parent 27f726d572
commit ecfee88353
4 changed files with 69 additions and 0 deletions

View File

@ -0,0 +1,12 @@
---
- hosts: "{{ ip_addr }}"
become: yes
become_method: sudo
gather_facts: no
tasks:
- name: "[CONFIG ZABBIX AGENT] Install and configure ZABBIX AGENT"
import_role:
name: config-zabbix-agent

View File

@ -0,0 +1,5 @@
# restart zabbix-agent service
- name: restart zabbix-agent
service:
name: "{{ zabbix_agent_daemon }}"
state: restarted

View File

@ -0,0 +1,47 @@
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Install and configure ZABBIX AGENT
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Paso1
# Download zabbix repository
- name: Download deb package
get_url:
url: "{{ deb_url }}"
dest: /tmp/"{{ deb_package_repo }}"
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# 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: "*"
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
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

View File

@ -0,0 +1,5 @@
# vars file
deb_url: https://repo.zabbix.com/zabbix/6.4/debian/pool/main/z/zabbix-release/zabbix-release_6.4-1+debian12_all.deb
deb_package_repo: zabbix-release_6.4-1+debian12_all.deb
zabbix_package: zabbix-agent
zabbix_agent_daemon: zabbix-agent