81 lines
2.1 KiB
YAML
81 lines
2.1 KiB
YAML
---
|
|
# tasks file for zabbix
|
|
- name: check OS version
|
|
debug: var=ansible_os_family
|
|
|
|
- name: include os variables
|
|
include_vars: "{{ ansible_os_family }}.yml"
|
|
tags: always
|
|
|
|
|
|
- name: Prepare Alma
|
|
when: ansible_distribution == "AlmaLinux"
|
|
block:
|
|
- name: add gpg
|
|
ansible.builtin.dnf:
|
|
name: gnupg2
|
|
state: present
|
|
- name: Import a key from a url
|
|
ansible.builtin.rpm_key:
|
|
state: present
|
|
key: https://repo.zabbix.com/RPM-GPG-KEY-ZABBIX-B5333005
|
|
- name: Add Package
|
|
ansible.builtin.dnf:
|
|
name: "https://repo.zabbix.com/zabbix/{{ zabbix_version }}/release/alma/{{ ansible_distribution_major_version }}/noarch/zabbix-release-latest-{{ zabbix_version }}.el{{ ansible_distribution_major_version }}.noarch.rpm"
|
|
state: present
|
|
|
|
- name: Prepare RH like
|
|
when: ansible_os_family == "RedHat"
|
|
block:
|
|
- name: disable firewall
|
|
ansible.builtin.service:
|
|
name: firewalld
|
|
state: stopped
|
|
enabled: false
|
|
- name: clean repo
|
|
ansible.builtin.shell:
|
|
cmd: dnf clean all
|
|
|
|
- name: Prepare Debian
|
|
when: ansible_os_family == "Debian"
|
|
block:
|
|
- name: Debian Repo
|
|
ansible.builtin.apt:
|
|
deb: "{{repo}}"
|
|
- name: Mise à jour le cache des paquets
|
|
ansible.builtin.apt:
|
|
update_cache: yes
|
|
|
|
- name: Database - Install
|
|
when: role == "db"
|
|
block:
|
|
- name: Install Zabbix DB
|
|
ansible.builtin.include_tasks: "{{ansible_os_family}}/install-db.yml"
|
|
when: role == "db"
|
|
tags:
|
|
- install_db
|
|
|
|
- name: Server - Install
|
|
ansible.builtin.include_tasks: "{{ansible_os_family}}/install-srv.yml"
|
|
when: role == "srv"
|
|
tags:
|
|
- install_srv
|
|
|
|
# - name: Proxy - Install
|
|
# ansible.builtin.include_tasks: "{{ansible_os_family}}/install-proxy.yml"
|
|
# tags:
|
|
# - install_proxy
|
|
# when: role == "proxy"
|
|
|
|
|
|
- name: Front - Install
|
|
ansible.builtin.include_tasks: "{{ansible_os_family}}/install-front.yml"
|
|
when: role == "srv"
|
|
tags:
|
|
- install_front
|
|
|
|
- name: Install Agent
|
|
ansible.builtin.include_tasks: "{{ansible_os_family}}/install-agent2.yml"
|
|
tags:
|
|
- install_agent
|
|
- never |