From 036dbed98b389c0fc388480e8c33e7701acac843 Mon Sep 17 00:00:00 2001 From: senyoltw Date: Sun, 22 Nov 2020 01:29:54 +0900 Subject: [PATCH] Split the way to enable support for software collection (CentOS and RHEL) (#266) * Split the way to enable support for software collection (CentOS and RedHat) --- changelogs/fragments/266-zabbix_web.yml | 4 ++++ docs/ZABBIX_WEB_ROLE.md | 3 ++- roles/zabbix_web/defaults/main.yml | 1 + roles/zabbix_web/tasks/RedHat.yml | 23 ++++++++++++++++++++++- 4 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 changelogs/fragments/266-zabbix_web.yml diff --git a/changelogs/fragments/266-zabbix_web.yml b/changelogs/fragments/266-zabbix_web.yml new file mode 100644 index 000000000..d231a1afa --- /dev/null +++ b/changelogs/fragments/266-zabbix_web.yml @@ -0,0 +1,4 @@ +bugfixes: + - zabbix_web - fixed issue Role cannot install Zabbix web 5.0 on RHEL 7 (https://github.com/ansible-collections/community.zabbix/issues/202). +minor_changes: + - zabbix_web - added `zabbix_web_rhel_release` which enable scl on RHEL (https://github.com/ansible-collections/community.zabbix/pull/266). diff --git a/docs/ZABBIX_WEB_ROLE.md b/docs/ZABBIX_WEB_ROLE.md index a2674fff7..b6c6bc99a 100644 --- a/docs/ZABBIX_WEB_ROLE.md +++ b/docs/ZABBIX_WEB_ROLE.md @@ -91,7 +91,8 @@ The following is an overview of all available configuration defaults for this ro * `zabbix_repo_yum_enabled`: A list with repository names that should be enabled when installing Zabbix component specific packages. * `zabbix_web_package_state`: Default: `present`. Can be overridden to `latest` to update packages when needed. -* `zabbix_web_centos_release`: Default: False. When the `centos-release-scl` repository needs to be enabled. This is required when using Zabbix 5.0 due to installation of a recent version of `PHP`. +* `zabbix_web_centos_release`: Default: True. When the `centos-release-scl` repository needs to be enabled. This is required when using Zabbix 5.0 due to installation of a recent version of `PHP`. +* `zabbix_web_rhel_release`: Default: True. When the `scl-utils` repository needs to be enabled. This is required when using Zabbix 5.0 due to installation of a recent version of `PHP`. * `zabbix_web_doubleprecision`: Default: `False`. For upgraded installations, please read database [upgrade notes](https://www.zabbix.com/documentation/current/manual/installation/upgrade_notes_500) (Paragraph "Enabling extended range of numeric (float) values") before enabling this option. * `zabbix_web_conf_mode`: Default: `0644`. The "mode" for the Zabbix configuration file. diff --git a/roles/zabbix_web/defaults/main.yml b/roles/zabbix_web/defaults/main.yml index c9e67f29d..9c96ee889 100644 --- a/roles/zabbix_web/defaults/main.yml +++ b/roles/zabbix_web/defaults/main.yml @@ -6,6 +6,7 @@ zabbix_version: "{{ zabbix_web_version }}" zabbix_repo: zabbix zabbix_web_package_state: present zabbix_web_centos_release: true +zabbix_web_rhel_release: true zabbix_selinux: False zabbix_web_doubleprecision: False zabbix_web_conf_mode: "0640" diff --git a/roles/zabbix_web/tasks/RedHat.yml b/roles/zabbix_web/tasks/RedHat.yml index de4e8554c..0f95c530a 100644 --- a/roles/zabbix_web/tasks/RedHat.yml +++ b/roles/zabbix_web/tasks/RedHat.yml @@ -44,7 +44,7 @@ tags: - zabbix-web -- name: "RedHat | Install zabbix-web dependency (Zabbix 5.x)" +- name: "RedHat | Install zabbix-web dependency (Zabbix 5.x) (CentOS)" yum: pkg: - centos-release-scl @@ -59,6 +59,27 @@ - zabbix_version is version('5.0', '>=') - zabbix_web_centos_release - ansible_distribution_major_version != '8' + - ansible_distribution == "CentOS" + tags: + - zabbix-web + +- name: "RedHat | Install zabbix-web dependency (Zabbix 5.x) (RHEL)" + yum: + pkg: + - scl-utils + - scl-utils-build + state: "{{ zabbix_web_package_state }}" + update_cache: yes + disablerepo: "{{ '*' if (zabbix_repo_yum_enabled | length>0) else omit }}" + enablerepo: "{{ zabbix_repo_yum_enabled if zabbix_repo_yum_enabled is iterable and (zabbix_repo_yum_enabled | length>0) else omit }}" + register: zabbix_web_dependency_package_install + until: zabbix_web_dependency_package_install is succeeded + become: yes + when: + - zabbix_version is version('5.0', '>=') + - zabbix_web_centos_release + - ansible_distribution_major_version != '8' + - ansible_distribution == "RedHat" tags: - zabbix-web