remove_zabbix-agent-plugins.yaml 4.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. ---
  2. - name: "Remove zabbix-agent2-plugins-* from RPM-based distros"
  3. hosts: all
  4. gather_facts: True
  5. become: true
  6. tasks:
  7. - name: "msg print to stdout: Debug ansible_facts"
  8. debug:
  9. msg:
  10. - ansible_facts.distribution "{{ ansible_facts.distribution }}"
  11. - ansible_facts.distribution_major_version "{{ ansible_facts.distribution_major_version }}"
  12. - ansible_facts.distribution_file_variety "{{ ansible_facts.distribution_file_variety }}"
  13. - name: Populate systemd service_facts
  14. service_facts:
  15. - name: Install Zabbix repo GPG key for ALL RHEL like
  16. rpm_key:
  17. state: present
  18. key: https://repo.zabbix.com/RPM-GPG-KEY-ZABBIX-08EFA7DD
  19. when: ansible_facts['distribution_file_variety'] == 'RedHat'
  20. # 06-05-2024: This fails with "Hash algorithm SHA1 not available". Not based bound to distor version.
  21. # - name: Install OLD Zabbix repo GPG key for ALL RHEL like
  22. # rpm_key:
  23. # state: present
  24. # key: https://repo.zabbix.com/RPM-GPG-KEY-ZABBIX-A14FE591
  25. # when: ansible_facts['distribution_file_variety'] == 'RedHat'
  26. #RHEL-7 like:
  27. - name: Install Official Zabbix repo for RHEL-7 like, incl. Fedora 19 - 27
  28. yum_repository:
  29. name: zabbix
  30. description: Install Zabbix official repo for RHEL-7 like
  31. baseurl: https://repo.zabbix.com/zabbix/6.4/rhel/$releasever/x86_64/
  32. enabled: yes
  33. when:
  34. - ansible_facts['distribution_file_variety'] == 'RedHat'
  35. - 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'
  36. #RHEL-8 like:
  37. - name: Install Official Zabbix repo for RHEL-8 like incl. Fedora 28 - 33
  38. yum_repository:
  39. name: zabbix
  40. description: Install Zabbix official repo for RHEL-8 like incl. Fedora 28 - 33
  41. baseurl: https://repo.zabbix.com/zabbix/6.4/rhel/8/x86_64/
  42. enabled: yes
  43. when:
  44. - ansible_facts['distribution_file_variety'] == 'RedHat'
  45. - 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'
  46. #RHEL-9 like:
  47. - name: Install Official Zabbix repo for RHEL-9 like incl. Fedora 34 - 40
  48. yum_repository:
  49. name: zabbix
  50. description: Install Zabbix official repo for RHEL-9 like incl. Fedora 34 - 40
  51. baseurl: https://repo.zabbix.com/zabbix/6.4/rhel/8/x86_64/
  52. enabled: yes
  53. when:
  54. - ansible_facts['distribution_file_variety'] == 'RedHat'
  55. - 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'
  56. ########################################################################################################################
  57. - name: Remove zabbix-agent2-plugins-*
  58. yum:
  59. name:
  60. - zabbix-agent2-plugin-mongodb
  61. - zabbix-agent2-plugin-mssql
  62. - zabbix-agent2-plugin-postgresql
  63. disablerepo: "epel"
  64. state: removed
  65. disable_gpg_check: true
  66. when:
  67. - ansible_facts['distribution_file_variety'] == 'RedHat'