role_zabbix/tasks/main.yml

74 lines
1.8 KiB
YAML

---
# tasks file for zabbix
- name: check OS version
debug: var=ansible_os_family
- name: Prepare RHEL
block:
- name: Alma Repo
ansible.builtin.shell:
cmd: rpm -Uvh https://repo.zabbix.com/zabbix/7.0/alma/9/x86_64/zabbix-release-latest.el9.noarch.rpm
- name: disable firewall
ansible.builtin.service:
name: firewalld
state: stopped
enabled: false
- name: clean repo
ansible.builtin.shell:
cmd: dnf clean all
when: ansible_os_family == "RedHat"
- name: Prepare Debian
block:
- name: Debian Repo
ansible.builtin.apt:
deb: https://repo.zabbix.com/zabbix/7.4/release/debian/pool/main/z/zabbix-release/zabbix-release_latest_7.4+debian13_all.deb
- name: Mise à jour le cache des paquets
ansible.builtin.apt:
update_cache: yes
when: ansible_os_family == "Debian"
- name: Install Database
when: role == "db"
block:
- name: Install Zabbix DB
ansible.builtin.include_tasks: install-db.yml
when: role == "db"
tags:
- database
tags:
- install_db
- name: Install server
when: role == "srv"
block:
- name: Install Zabbix Server
ansible.builtin.include_tasks: install-srv.yml
when: role == "srv"
tags:
- install_srv
- name: Install zabbix_proxy
when: role == "proxy"
block:
- name: Install Zabbix Proxy
ansible.builtin.include_tasks: install-proxy.yml
when: role == "proxy"
tags:
- install_proxy
- name: Install Front
when: role == "front"
block:
- name: Install Zabbix Front
ansible.builtin.include_tasks: install-front.yml
when: role == "front"
tags:
- install_front
- name: Install Agent
block:
- name: Install Zabbix Agent
ansible.builtin.include_tasks: install-agent2.yml
tags:
- install_agent
- never