From 7ee5107160534290f8cca4910ce9ed6f1c9951b2 Mon Sep 17 00:00:00 2001 From: Erik Berg Date: Sun, 9 Jun 2024 10:56:49 +0200 Subject: [PATCH] Single task for installing zabbix-nginx-conf --- roles/zabbix_web/tasks/nginx.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/nginx.yml b/roles/zabbix_web/tasks/nginx.yml index 1f50263ca..1fa540c18 100644 --- a/roles/zabbix_web/tasks/nginx.yml +++ b/roles/zabbix_web/tasks/nginx.yml @@ -11,35 +11,17 @@ - install - name: "Nginx | Installing Zabbix Nginx Conf" - block: - - name: "Debian | Install zabbix-nginx-conf" - ansible.builtin.apt: - pkg: "zabbix-nginx-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-nginx-conf" - ansible.builtin.yum: - name: - - "zabbix-nginx-conf" - 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_nginx_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 f5fb7337d..891849874 100644 --- a/roles/zabbix_web/vars/Debian.yml +++ b/roles/zabbix_web/vars/Debian.yml @@ -47,3 +47,4 @@ zabbix_valid_web_versions: _zabbix_web_package: zabbix-frontend-php _zabbix_web_apache_package: zabbix-apache-conf +_zabbix_web_nginx_package: zabbix-nginx-conf diff --git a/roles/zabbix_web/vars/RedHat.yml b/roles/zabbix_web/vars/RedHat.yml index 24c87c346..f2a39887a 100644 --- a/roles/zabbix_web/vars/RedHat.yml +++ b/roles/zabbix_web/vars/RedHat.yml @@ -30,5 +30,6 @@ zabbix_valid_web_versions: _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_nginx_package: "zabbix-nginx-conf-{{ zabbix_web_version }}.{{ zabbix_web_version_minor }}" _zabbix_web_disable_repo: - epel