From 3cb8643974fe4c5fcc7217c54eec6a30cc527019 Mon Sep 17 00:00:00 2001 From: Erik Berg Date: Sun, 9 Jun 2024 10:23:13 +0200 Subject: [PATCH] Single task for installing zabbix-apache-conf Also, this zabbix_agent_disable_repo is probably a copy-paste error introduced at some point. --- roles/zabbix_web/tasks/apache.yml | 40 +++++++++---------------------- roles/zabbix_web/vars/Debian.yml | 1 + roles/zabbix_web/vars/RedHat.yml | 1 + 3 files changed, 13 insertions(+), 29 deletions(-) diff --git a/roles/zabbix_web/tasks/apache.yml b/roles/zabbix_web/tasks/apache.yml index fa7e78e03..2753991ed 100644 --- a/roles/zabbix_web/tasks/apache.yml +++ b/roles/zabbix_web/tasks/apache.yml @@ -8,35 +8,17 @@ - always - name: "Apache | Installing Zabbix Apache Conf" - block: - - name: "Debian | Install zabbix-apache-conf" - ansible.builtin.apt: - pkg: "zabbix-apache-conf" - state: "{{ zabbix_web_package_state }}" - update_cache: true - cache_valid_time: 0 - environment: - http_proxy: "{{ zabbix_http_proxy | default(None) | default(omit) }}" - https_proxy: "{{ zabbix_https_proxy | default(None) | default(omit) }}" - register: zabbix_apache_conf_install - until: zabbix_apache_conf_install is succeeded - become: true - when: ansible_os_family == "Debian" - - - name: "RedHat | Install zabbix-apache-conf" - ansible.builtin.yum: - name: - - "zabbix-apache-conf-{{ zabbix_web_version }}.{{ zabbix_web_version_minor | default ('*')}}" - state: "{{ zabbix_web_package_state }}" - update_cache: true - disablerepo: "{{ zabbix_agent_disable_repo | default(omit) }}" - environment: - http_proxy: "{{ zabbix_http_proxy | default(None) | default(omit) }}" - https_proxy: "{{ zabbix_https_proxy | default(None) | default(omit) }}" - register: zabbix_apache_conf_install - until: zabbix_apache_conf_install is succeeded - become: true - when: ansible_os_family == "RedHat" + package: + name: "{{ _zabbix_web_apache_package }}" + state: "{{ zabbix_web_package_state }}" + update_cache: true + disablerepo: "{{ zabbix_web_disable_repo | default(_zabbix_web_disable_repo | default(omit)) }}" + environment: + http_proxy: "{{ zabbix_http_proxy | default(None) | default(omit) }}" + https_proxy: "{{ zabbix_https_proxy | default(None) | default(omit) }}" + register: zabbix_apache_conf_install + until: zabbix_apache_conf_install is succeeded + become: true tags: - install diff --git a/roles/zabbix_web/vars/Debian.yml b/roles/zabbix_web/vars/Debian.yml index cb2cc0814..f5fb7337d 100644 --- a/roles/zabbix_web/vars/Debian.yml +++ b/roles/zabbix_web/vars/Debian.yml @@ -46,3 +46,4 @@ zabbix_valid_web_versions: - 6.0 _zabbix_web_package: zabbix-frontend-php +_zabbix_web_apache_package: zabbix-apache-conf diff --git a/roles/zabbix_web/vars/RedHat.yml b/roles/zabbix_web/vars/RedHat.yml index 674a64b40..24c87c346 100644 --- a/roles/zabbix_web/vars/RedHat.yml +++ b/roles/zabbix_web/vars/RedHat.yml @@ -29,5 +29,6 @@ zabbix_valid_web_versions: - 6.0 _zabbix_web_package: "zabbix-web-{{ zabbix_server_database }}-{{ zabbix_web_version }}.{{ zabbix_web_version_minor }}" +_zabbix_web_apache_package: "zabbix-apache-conf-{{ zabbix_web_version }}.{{ zabbix_web_version_minor }}" _zabbix_web_disable_repo: - epel