| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- ---
- - name: "Remove zabbix-agent2-plugins-* from RPM-based distros"
- hosts: all
- gather_facts: True
- become: true
- tasks:
- - name: "msg print to stdout: Debug ansible_facts"
- debug:
- msg:
- - ansible_facts.distribution "{{ ansible_facts.distribution }}"
- - ansible_facts.distribution_major_version "{{ ansible_facts.distribution_major_version }}"
- - ansible_facts.distribution_file_variety "{{ ansible_facts.distribution_file_variety }}"
- - name: Populate systemd service_facts
- service_facts:
- - name: Install Zabbix repo GPG key for ALL RHEL like
- rpm_key:
- state: present
- key: https://repo.zabbix.com/RPM-GPG-KEY-ZABBIX-08EFA7DD
- when: ansible_facts['distribution_file_variety'] == 'RedHat'
- # 06-05-2024: This fails with "Hash algorithm SHA1 not available". Not based bound to distor version.
- # - name: Install OLD Zabbix repo GPG key for ALL RHEL like
- # rpm_key:
- # state: present
- # key: https://repo.zabbix.com/RPM-GPG-KEY-ZABBIX-A14FE591
- # when: ansible_facts['distribution_file_variety'] == 'RedHat'
- #RHEL-7 like:
- - name: Install Official Zabbix repo for RHEL-7 like, incl. Fedora 19 - 27
- yum_repository:
- name: zabbix
- description: Install Zabbix official repo for RHEL-7 like
- baseurl: https://repo.zabbix.com/zabbix/6.4/rhel/$releasever/x86_64/
- enabled: yes
- when:
- - ansible_facts['distribution_file_variety'] == 'RedHat'
- - ansible_facts['distribution_major_version'] == '7' or ansible_facts['distribution_major_version'] == '19' or ansible_facts['distribution_major_version'] == '20' or ansible_facts['distribution_major_version'] == '21' or ansible_facts['distribution_major_version'] == '22' or ansible_facts['distribution_major_version'] == '23' or ansible_facts['distribution_major_version'] == '24' or ansible_facts['distribution_major_version'] == '25' or ansible_facts['distribution_major_version'] == '26' or ansible_facts['distribution_major_version'] == '27'
- #RHEL-8 like:
- - name: Install Official Zabbix repo for RHEL-8 like incl. Fedora 28 - 33
- yum_repository:
- name: zabbix
- description: Install Zabbix official repo for RHEL-8 like incl. Fedora 28 - 33
- baseurl: https://repo.zabbix.com/zabbix/6.4/rhel/8/x86_64/
- enabled: yes
- when:
- - ansible_facts['distribution_file_variety'] == 'RedHat'
- - ansible_facts['distribution_major_version'] == '8' or ansible_facts['distribution_major_version'] == '28' or ansible_facts['distribution_major_version'] == '29' or ansible_facts['distribution_major_version'] == '30' or ansible_facts['distribution_major_version'] == '31' or ansible_facts['distribution_major_version'] == '32' or ansible_facts['distribution_major_version'] == '33'
- #RHEL-9 like:
- - name: Install Official Zabbix repo for RHEL-9 like incl. Fedora 34 - 40
- yum_repository:
- name: zabbix
- description: Install Zabbix official repo for RHEL-9 like incl. Fedora 34 - 40
- baseurl: https://repo.zabbix.com/zabbix/6.4/rhel/8/x86_64/
- enabled: yes
- when:
- - ansible_facts['distribution_file_variety'] == 'RedHat'
- - ansible_facts['distribution_major_version'] == '9' or ansible_facts['distribution_major_version'] == '34' or ansible_facts['distribution_major_version'] == '35' or ansible_facts['distribution_major_version'] == '36' or ansible_facts['distribution_major_version'] == '37' or ansible_facts['distribution_major_version'] == '38' or ansible_facts['distribution_major_version'] == '39' or ansible_facts['distribution_major_version'] == '40'
- ########################################################################################################################
- - name: Remove zabbix-agent2-plugins-*
- yum:
- name:
- - zabbix-agent2-plugin-mongodb
- - zabbix-agent2-plugin-mssql
- - zabbix-agent2-plugin-postgresql
- disablerepo: "epel"
- state: removed
- disable_gpg_check: true
- when:
- - ansible_facts['distribution_file_variety'] == 'RedHat'
|