--- # 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: Copie GPG key ansible.builtin.copy: src: RPM-GPG-KEY-ZABBIX-B5333005 dest: /tmp/RPM-GPG-KEY-ZABBIX-B5333005 - name: Import a key ansible.builtin.rpm_key: state: present key: /tmp/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: set selinux permivise ansible.builtin.lineinfile: path: /etc/selinux/config regexp: '^SELINUX=.*' line: "SELINUX=permissive" register: selinux - name: Reboot if necessary ansible.builtin.reboot: when: selinux.changed - name: Prepare Debian when: ansible_os_family == "Debian" block: - name: Debian Repo ansible.builtin.apt: deb: "https://repo.zabbix.com/zabbix/{{ zabbix_version }}/release/debian/pool/main/z/zabbix-release/zabbix-release_latest_{{ zabbix_version }}+debian13_all.deb" - 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" or role == "front" tags: - install_front - name: Install Agent ansible.builtin.include_tasks: "{{ansible_os_family}}/install-agent2.yml" tags: - install_agent - never