Skip to content

Commit

Permalink
Single task for installing zabbix-nginx-conf
Browse files Browse the repository at this point in the history
  • Loading branch information
eb4x committed Jun 9, 2024
1 parent 3cb8643 commit 7ee5107
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 29 deletions.
40 changes: 11 additions & 29 deletions roles/zabbix_web/tasks/nginx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions roles/zabbix_web/vars/Debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions roles/zabbix_web/vars/RedHat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 7ee5107

Please sign in to comment.