Skip to content

Commit

Permalink
Reflected needed changes for zabbix 5.x on el7/SCL php
Browse files Browse the repository at this point in the history
Signed-off-by: Fabian Arrotin <arrfab@centos.org>
  • Loading branch information
arrfab committed Feb 4, 2021
1 parent aa0eb5c commit f33c48a
Show file tree
Hide file tree
Showing 7 changed files with 128 additions and 6 deletions.
4 changes: 4 additions & 0 deletions handlers/main.yml
Expand Up @@ -5,3 +5,7 @@
service:
name: zabbix-server
state: restarted
- name: restart_rh_php73_fpm
service:
name: rh-php73-php-fpm
state: restarted
5 changes: 1 addition & 4 deletions tasks/cli.yml
@@ -1,10 +1,7 @@
- name: Ensuring some cli tools are available for wrapper scripts
yum:
name: "{{ item }}"
name: ['zabbix-cli', 'jq']
state: installed
with_items:
- zabbix-cli
- jq

- name: Directory structure for zabbix-cli
file:
Expand Down
42 changes: 41 additions & 1 deletion tasks/main.yml
@@ -1,6 +1,15 @@
---
# tasks file for zabbix-server


- name: Importing specific distro variables
include_vars: "{{ item }}"
with_first_found:
- "{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yml"
- "{{ ansible_distribution }}.yml"
tags:
- vars

- block:
- name: Creating mandatory DB
include_role:
Expand Down Expand Up @@ -43,11 +52,42 @@
name: httpd
tasks_from: tls

- block:
- include_role:
name: httpd
tasks_from: scl-php
- name: Installing some PHP pkgs from SCL (el7)
yum:
name: "{{ zabbix_php_pkgs }}"
state: latest
notify: restart_httpd
# Removing (for upgrade case) some pkgs before installing new ones (strange deps loop)
- name: Cleaning up non SCL pkgs before installing new ones (el7)
yum:
name: zabbix-web-mysql
state: removed
# Fix for php73 it doesn't seem provided in zabbix rpm but it was for php72
- name: Configuring php73-fpm for zabbix
template:
src: rh-php73-fpm-zabbix.conf.j2
dest: /etc/opt/rh/rh-php73/php-fpm.d/zabbix.conf
notify: restart_rh_php73_fpm

when: ansible_distribution_major_version == '7'

- name: Installing required pkgs for Zabbix
yum:
name: ['zabbix-web-mysql', 'zabbix-server-mysql', 'zabbix-get', 'bind-utils']
name: "{{ zabbix_server_pkgs }}"
state: latest

- name: Specific config for php73/scl (el7)
template:
src: httpd-php-zabbix.conf.j2
dest: /etc/httpd/conf.d/zabbix.conf
notify: restart_httpd
when: ansible_distribution_major_version == '7'


- name: Finding the schema to load in mysql
shell: find /usr/share/doc -iname create.sql.gz|grep zabbix
register: zabbix_sql_schema
Expand Down
2 changes: 1 addition & 1 deletion tasks/selinux.yml
Expand Up @@ -19,7 +19,7 @@
- selinux
when: ansible_selinux.status == "enabled"

- name: Reloading selinux polic on change
- name: Reloading selinux policy on change
shell: "/usr/sbin/semodule -u /etc/selinux/centos/{{ item.item }}"
with_items: "{{ sepolicy.results }}"
when: item.changed
Expand Down
37 changes: 37 additions & 0 deletions templates/httpd-php-zabbix.conf.j2
@@ -0,0 +1,37 @@
#
# Zabbix monitoring system php web frontend
#

Alias /zabbix /usr/share/zabbix

<Directory "/usr/share/zabbix">
Options FollowSymLinks
AllowOverride None
Require all granted

<IfModule dir_module>
DirectoryIndex index.php
</IfModule>

<FilesMatch \.(php|phar)$>
# SetHandler "proxy:unix:/var/opt/rh/rh-php72/run/php-fpm/zabbix.sock|fcgi://localhost"
SetHandler "proxy:unix:/var/opt/rh/rh-php73/run/php-fpm/zabbix.sock|fcgi://localhost"
</FilesMatch>
</Directory>

<Directory "/usr/share/zabbix/conf">
Require all denied
</Directory>

<Directory "/usr/share/zabbix/app">
Require all denied
</Directory>

<Directory "/usr/share/zabbix/include">
Require all denied
</Directory>

<Directory "/usr/share/zabbix/local">
Require all denied
</Directory>

25 changes: 25 additions & 0 deletions templates/rh-php73-fpm-zabbix.conf.j2
@@ -0,0 +1,25 @@
[zabbix]
user = apache
group = apache

listen = /var/opt/rh/rh-php73/run/php-fpm/zabbix.sock
listen.acl_users = apache
listen.allowed_clients = 127.0.0.1

pm = dynamic
pm.max_children = 50
pm.start_servers = 5
pm.min_spare_servers = 5
pm.max_spare_servers = 35

php_value[session.save_handler] = files
php_value[session.save_path] = /var/opt/rh/rh-php73/lib/php/session/

php_value[max_execution_time] = 300
php_value[memory_limit] = 128M
php_value[post_max_size] = 16M
php_value[upload_max_filesize] = 2M
php_value[max_input_time] = 300
php_value[max_input_vars] = 10000
php_value[date.timezone] = Etc/UTC

19 changes: 19 additions & 0 deletions vars/CentOS-7.yml
@@ -0,0 +1,19 @@
zabbix_server_pkgs:
- zabbix-server-mysql
- zabbix-web
- zabbix-web-mysql-scl
- zabbix-web-deps-scl
- zabbix-apache-conf-scl
- zabbix-get
- bind-utils

zabbix_php_pkgs:
- rh-php73
- rh-php73-php-bcmath
- rh-php73-php-fpm
- rh-php73-php-gd
- rh-php73-php-ldap
- rh-php73-php-mbstring
- rh-php73-php-xml
- rh-php73-php-mysqlnd

0 comments on commit f33c48a

Please sign in to comment.