Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

One attempt to fix the installation of the correct php packages #344

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion roles/zabbix_web/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ zabbix_web_htpasswd_file: /etc/zabbix/web/htpasswd
zabbix_timezone: Europe/Amsterdam
zabbix_vhost: True

zabbix_php_install: true
zabbix_php_frontend_deprecated: False
zabbix_php_fpm: False
zabbix_php_fpm_dir_etc: /etc/opt/rh/rh-php72/
Expand Down Expand Up @@ -86,7 +87,6 @@ zabbix_5_repo_yum:
gpgkey: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
state: present

zabbix_php_install: true
zabbix_web_max_execution_time: 300
zabbix_web_memory_limit: 128M
zabbix_web_post_max_size: 16M
Expand Down Expand Up @@ -122,3 +122,4 @@ zabbix_server_history_types:
- 'dbl'

selinux_allow_zabbix_can_network: False
_zabbix_web_apache_php_addition: False
1 change: 1 addition & 0 deletions roles/zabbix_web/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
set_fact:
zabbix_short_version: "{{ zabbix_version | regex_replace('\\.', '') }}"
zabbix_php_version: "{{ zabbix_php_version if zabbix_php_version is defined else _zabbix_php_version }}"
_zabbix_php_package_prefix: ''
tags:
- always

Expand Down
58 changes: 26 additions & 32 deletions roles/zabbix_web/tasks/php_Debian.yml
Original file line number Diff line number Diff line change
@@ -1,44 +1,38 @@
---
- name: "Debian | Install legacy php5 packages on old distros"
apt:
state: present
update_cache: yes
cache_valid_time: 3600
name:
- php5-{{ zabbix_server_database }}
- php5-bcmath
- php5-mbstring
- php5-ldap
- php5-xml
- php5-gd
register: zabbix_web_php_dependency_install
until: zabbix_web_php_dependency_install is succeeded
become: yes
when: >
( ansible_distribution == 'Ubuntu' and (ansible_distribution_version is version_compare('16.04', '<')))
or ( ansible_distribution == 'Debian' and (ansible_distribution_version is version_compare('9', '<')) )
tags:
- zabbix-web
- init

- name: "Debian | Install modern php packages on current distros"
# This obviously needs to have some improvements.. :)

- name: "Debian | Determine php prefix for packages installations (legacy php5)"
set_fact:
_zabbix_php_package_prefix: 5
when:
- ansible_distribution == 'Ubuntu' and ansible_distribution_version is version_compare('16.04', '<')
or ansible_distribution == 'Debian' and ansible_distribution_version is version_compare('9', '<')

- name: "Debian | Determine php prefix for packages installations (Current distros)"
set_fact:
_zabbix_php_package_prefix: "{{ zabbix_php_version }}"
when:
- ansible_distribution == 'Ubuntu' and ansible_distribution_version is version_compare('16.04', '>=') or
ansible_distribution == 'Debian' and ansible_distribution_version is version_compare('9', '>=')
- zabbix_version is version_compare('5.0', '>=')
- not _zabbix_web_apache_php_addition

- name: "Debian | Install php packages"
apt:
state: present
update_cache: yes
cache_valid_time: 3600
name:
- php-{{ zabbix_server_database }}
- php-bcmath
- php-mbstring
- php-ldap
- php-xml
- php-gd
- php{{ _zabbix_php_package_prefix }}-{{ zabbix_server_database }}
- php{{ _zabbix_php_package_prefix }}-bcmath
- php{{ _zabbix_php_package_prefix }}-mbstring
- php{{ _zabbix_php_package_prefix }}-ldap
- php{{ _zabbix_php_package_prefix }}-xml
- php{{ _zabbix_php_package_prefix }}-gd
register: zabbix_web_php_dependency_install
until: zabbix_web_php_dependency_install is succeeded
become: yes
when: >
( ansible_distribution == 'Ubuntu' and (ansible_distribution_version is version_compare('16.04', '>=')))
or ( ansible_distribution == 'Debian' and (ansible_distribution_version is version_compare('9', '>=')) )
tags:
- zabbix-server
- zabbix-web
- init