Skip to content

Commit

Permalink
Move installation of debian php deps
Browse files Browse the repository at this point in the history
By converting zabbix_web_http_server_package to a list of one
package, we can add zabbix_web_php_dependencies to it during
installation of those packages.
  • Loading branch information
eb4x committed Jun 9, 2024
1 parent 3e1036b commit 3d8e0ac
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 30 deletions.
22 changes: 0 additions & 22 deletions roles/zabbix_web/tasks/Debian.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,10 @@
---
- name: "Debian | Set PHP Dependencies"
ansible.builtin.set_fact:
zabbix_web_php_dependencies: "{{ _apache_php_dependencies if zabbix_web_http_server == 'apache' else _nginx_php_dependencies }}"
tags:
- config

- name: "Debian | Set some variables"
ansible.builtin.set_fact:
zabbix_underscore_version: "{{ zabbix_web_version | regex_replace('\\.', '_') }}"
tags:
- always

- name: "Debian | Install PHP Dependencies"
ansible.builtin.apt:
pkg: "{{ zabbix_web_php_dependencies }}"
state: "present"
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_web_php_dependencies_install
until: zabbix_web_php_dependencies_install is succeeded
become: true
tags:
- install
- dependencies

- name: "Debian | Install PgSQL Dependencies"
ansible.builtin.apt:
pkg: "php{{ zabbix_web_php_installed_version }}-pgsql"
Expand Down
2 changes: 1 addition & 1 deletion roles/zabbix_web/tasks/apache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

- name: "Apache | Installing Zabbix Apache Conf"
package:
name: "{{ _zabbix_web_apache_package }}"
name: "{{ _zabbix_web_apache_packages + _zabbix_web_apache_php_dependencies | default([]) }}"
state: "{{ zabbix_web_package_state }}"
update_cache: true
disablerepo: "{{ zabbix_web_disable_repo | default(_zabbix_web_disable_repo | default(omit)) }}"
Expand Down
2 changes: 1 addition & 1 deletion roles/zabbix_web/tasks/nginx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

- name: "Nginx | Installing Zabbix Nginx Conf"
package:
name: "{{ _zabbix_web_nginx_package }}"
name: "{{ _zabbix_web_nginx_packages + _zabbix_web_nginx_php_dependencies | default([]) }}"
state: "{{ zabbix_web_package_state }}"
update_cache: true
disablerepo: "{{ zabbix_web_disable_repo | default(_zabbix_web_disable_repo | default(omit)) }}"
Expand Down
11 changes: 7 additions & 4 deletions roles/zabbix_web/vars/Debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ _zabbix_php_fpm_listen: /run/php/zabbix.sock
_zabbix_php_fpm_mode: "0666"
_zabbix_php_fpm_allowed_clients: 127.0.0.1

_apache_php_dependencies: libapache2-mod-php{{ zabbix_web_php_installed_version }}
_nginx_php_dependencies: []

_nginx_user: www-data
_nginx_group: www-data
Expand Down Expand Up @@ -46,5 +44,10 @@ zabbix_valid_web_versions:
- 6.0

_zabbix_web_package: zabbix-frontend-php
_zabbix_web_apache_package: zabbix-apache-conf
_zabbix_web_nginx_package: zabbix-nginx-conf
_zabbix_web_apache_packages:
- zabbix-apache-conf
_zabbix_web_apache_php_dependencies:
- "libapache2-mod-php{{ zabbix_web_php_installed_version }}"
_zabbix_web_nginx_packages:
- zabbix-nginx-conf
_zabbix_web_nginx_php_dependencies: []
6 changes: 4 additions & 2 deletions roles/zabbix_web/vars/RedHat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ 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_nginx_package: "zabbix-nginx-conf-{{ zabbix_web_version }}.{{ zabbix_web_version_minor }}"
_zabbix_web_apache_packages:
- "zabbix-apache-conf-{{ zabbix_web_version }}.{{ zabbix_web_version_minor }}"
_zabbix_web_nginx_packages:
- "zabbix-nginx-conf-{{ zabbix_web_version }}.{{ zabbix_web_version_minor }}"
_zabbix_web_disable_repo:
- epel

0 comments on commit 3d8e0ac

Please sign in to comment.