From fde60d2771aa7a798613c03dfc1cc985add74e09 Mon Sep 17 00:00:00 2001 From: Werner Dijkerman Date: Sun, 12 Jul 2020 13:24:08 +0200 Subject: [PATCH 1/8] Go to Zabbix 5.0; Added some php-fpm stuff for recent version of PHP --- docs/ZABBIX_WEB_ROLE.md | 1 + roles/zabbix_javagateway/defaults/main.yml | 2 +- roles/zabbix_proxy/defaults/main.yml | 3 +- roles/zabbix_server/defaults/main.yml | 2 +- roles/zabbix_web/defaults/main.yml | 16 ++++++- roles/zabbix_web/handlers/main.yml | 9 ++++ roles/zabbix_web/tasks/RedHat.yml | 44 ++++++++++++++++++- roles/zabbix_web/tasks/apache_RedHat.yml | 12 +++++ .../zabbix_web/templates/apache_vhost.conf.j2 | 13 ++++++ roles/zabbix_web/templates/php-fpm.conf.j2 | 24 ++++++++++ 10 files changed, 120 insertions(+), 6 deletions(-) create mode 100644 roles/zabbix_web/handlers/main.yml create mode 100644 roles/zabbix_web/templates/php-fpm.conf.j2 diff --git a/docs/ZABBIX_WEB_ROLE.md b/docs/ZABBIX_WEB_ROLE.md index 4838bde86..bf68d9c6c 100644 --- a/docs/ZABBIX_WEB_ROLE.md +++ b/docs/ZABBIX_WEB_ROLE.md @@ -83,6 +83,7 @@ The following is an overview of all available configuration defaults for this ro * `zabbix_web_version`: This is the version of zabbix. Default: 4.4, Can be overridden to 4.0, 3.4, 3.2, 3.0, 2.4, or 2.2. Previously the variable `zabbix_version` was used directly but it could cause [some inconvenience](https://github.com/dj-wasabi/ansible-zabbix-agent/pull/303). That variable is maintained by retrocompativility. * `zabbix_repo_yum`: A list with Yum repository configuration. * `zabbix_web_package_state`: Default: _present_. Can be overridden to "latest" to update packages when needed. +* `zabbix_web_centos_release`: Default: False. When the `centos-release-scl` repository needs to be enabled. This is required when using Zabbix 5.0 due to installation of a recent version of `PHP`. ### Zabbix Web specific diff --git a/roles/zabbix_javagateway/defaults/main.yml b/roles/zabbix_javagateway/defaults/main.yml index 3ffbe6dc2..dff7446a6 100644 --- a/roles/zabbix_javagateway/defaults/main.yml +++ b/roles/zabbix_javagateway/defaults/main.yml @@ -1,7 +1,7 @@ --- # defaults file for dj-wasabi.zabbix-javagateway -zabbix_version: 4.2 +zabbix_version: 5.0 zabbix_repo: zabbix zabbix_package_state: present zabbix_selinux: False diff --git a/roles/zabbix_proxy/defaults/main.yml b/roles/zabbix_proxy/defaults/main.yml index d3245c44b..05d383db4 100644 --- a/roles/zabbix_proxy/defaults/main.yml +++ b/roles/zabbix_proxy/defaults/main.yml @@ -1,7 +1,8 @@ --- # defaults file for zabbix-proxy -zabbix_version: 4.4 +zabbix_version: 5.0 +zabbix_selinux: False # These variables are optional. They specify the version of Zabbix proxy package. diff --git a/roles/zabbix_server/defaults/main.yml b/roles/zabbix_server/defaults/main.yml index 5adb7edce..4aecd6102 100644 --- a/roles/zabbix_server/defaults/main.yml +++ b/roles/zabbix_server/defaults/main.yml @@ -2,7 +2,7 @@ # defaults file; # zabbix role specific -zabbix_server_version: 4.4 +zabbix_server_version: 5.0 zabbix_version: "{{ zabbix_server_version }}" zabbix_repo: zabbix diff --git a/roles/zabbix_web/defaults/main.yml b/roles/zabbix_web/defaults/main.yml index b143f5fb7..70301474b 100644 --- a/roles/zabbix_web/defaults/main.yml +++ b/roles/zabbix_web/defaults/main.yml @@ -1,10 +1,11 @@ --- # defaults file for zabbix-web -zabbix_web_version: 4.4 +zabbix_web_version: 5.0 zabbix_version: "{{ zabbix_web_version }}" zabbix_repo: zabbix zabbix_web_package_state: present +zabbix_web_centos_release: true zabbix_selinux: False zabbix_url: zabbix.example.com @@ -16,6 +17,8 @@ zabbix_apache_vhost_tls_port: 443 zabbix_timezone: Europe/Amsterdam zabbix_vhost: True zabbix_php_fpm: False +zabbix_php_fpm_dir_etc: /etc/opt/rh/rh-php72/ +zabbix_php_fpm_dir_var: /var/opt/rh/rh-php72/ zabbix_apache_vhost_listen_ip: "*" zabbix_apache_tls: False zabbix_apache_redirect: False @@ -31,19 +34,28 @@ zabbix_repo_yum: gpgcheck: 0 gpgkey: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX state: present - - name: zabbix-supported + - name: zabbix-non-supported description: Zabbix Official Repository non-supported - $basearch baseurl: http://repo.zabbix.com/non-supported/rhel/{{ ansible_distribution_major_version }}/$basearch/ gpgcheck: 0 gpgkey: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX state: present +zabbix_5_repo_yum: + - name: zabbix-frontend + description: Zabbix Official Repository - $basearch + baseurl: http://repo.zabbix.com/zabbix/{{ zabbix_version }}/rhel/{{ ansible_distribution_major_version }}/$basearch/frontend/ + gpgcheck: 0 + 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 zabbix_web_upload_max_filesize: 2M zabbix_web_max_input_time: 300 +zabbix_web_max_input_vars: 10000 zabbix_apache_include_custom_fragment: true zabbix_apache_SSLPassPhraseDialog: exec:/usr/libexec/httpd-ssl-pass-dialog diff --git a/roles/zabbix_web/handlers/main.yml b/roles/zabbix_web/handlers/main.yml new file mode 100644 index 000000000..4dced5178 --- /dev/null +++ b/roles/zabbix_web/handlers/main.yml @@ -0,0 +1,9 @@ +--- + +- name: restart rh-php72-php-fpm + service: + name: rh-php72-php-fpm + state: restarted + enabled: yes + when: + - zabbix_version is version('5.0', '>=') diff --git a/roles/zabbix_web/tasks/RedHat.yml b/roles/zabbix_web/tasks/RedHat.yml index 407ee3c83..c9c96c911 100644 --- a/roles/zabbix_web/tasks/RedHat.yml +++ b/roles/zabbix_web/tasks/RedHat.yml @@ -15,9 +15,51 @@ tags: - zabbix-web +- name: "RedHat | Install basic repo file (Zabbix 5.x)" + yum_repository: + name: "{{ item.name }}" + description: "{{ item.description }}" + baseurl: "{{ item.baseurl }}" + gpgcheck: "{{ item.gpgcheck }}" + gpgkey: "{{ item.gpgkey }}" + state: "{{ item.state | default('present') }}" + with_items: "{{ zabbix_5_repo_yum }}" + when: + - zabbix_repo == "zabbix" + - zabbix_version is version('5.0', '>=') + tags: + - zabbix-web + +- name: "RedHat | Install zabbix-web dependency (Zabbix 5.x)" + yum: + pkg: + - centos-release-scl + state: "{{ zabbix_web_package_state }}" + update_cache: yes + register: zabbix_web_dependency_package_install + until: zabbix_web_dependency_package_install is succeeded + when: + - zabbix_version is version('5.0', '>=') + - zabbix_web_centos_release + tags: + - zabbix-web + +- name: "RedHat | Install zabbix-web (Zabbix 5.x)" + yum: + pkg: + - "{{ 'zabbix-apache-conf-scl' if zabbix_websrv == 'apache' }}" + state: "{{ zabbix_web_package_state }}" + update_cache: yes + register: zabbix_web_package_install + until: zabbix_web_package_install is succeeded + when: + - zabbix_version is version('5.0', '>=') + tags: + - zabbix-web + - name: "RedHat | Install zabbix-web-{{ zabbix_server_database }}" yum: - pkg: zabbix-web-{{ zabbix_server_database }} + pkg: zabbix-web-{{ zabbix_server_database }}{{ '-scl' if zabbix_version is version('5.0', '>=') }} state: "{{ zabbix_web_package_state }}" update_cache: yes register: zabbix_web_package_install diff --git a/roles/zabbix_web/tasks/apache_RedHat.yml b/roles/zabbix_web/tasks/apache_RedHat.yml index d018e093c..79208d30a 100644 --- a/roles/zabbix_web/tasks/apache_RedHat.yml +++ b/roles/zabbix_web/tasks/apache_RedHat.yml @@ -1,4 +1,16 @@ --- + +- name: "RedHat | Install PHP" + template: + src: php-fpm.conf.j2 + dest: "{{ zabbix_php_fpm_dir_etc }}/php-fpm.d/zabbix.conf" + owner: "{{ apache_user }}" + group: "{{ apache_group }}" + mode: 0644 + when: zabbix_vhost + notify: + - restart rh-php72-php-fpm + - name: "RedHat | Install apache vhost" template: src: apache_vhost.conf.j2 diff --git a/roles/zabbix_web/templates/apache_vhost.conf.j2 b/roles/zabbix_web/templates/apache_vhost.conf.j2 index e24de974f..62498f6eb 100644 --- a/roles/zabbix_web/templates/apache_vhost.conf.j2 +++ b/roles/zabbix_web/templates/apache_vhost.conf.j2 @@ -25,6 +25,15 @@ Order Allow,Deny Allow from all {% endif %} + + + DirectoryIndex index.php + + + + SetHandler "proxy:unix:/var/opt/rh/rh-php72/run/php-fpm/zabbix.sock|fcgi://localhost" + + {% for my_path in directory_paths %} @@ -48,6 +57,7 @@ RewriteEngine On RewriteRule ^$ /index.php [L] +{% if zabbix_version is version('5.0', '<=') %} {% if zabbix_apache_include_custom_fragment | default(true) %} ## Custom fragment {% if zabbix_php_fpm %} @@ -62,6 +72,7 @@ # Set correct timezone. php_value date.timezone {{ zabbix_timezone }} {% endif %} +{% endif %} {# Set up TLS vhosts #} @@ -131,6 +142,7 @@ SSLCryptoDevice {{ zabbix_apache_SSLCryptoDevice }} RewriteEngine On RewriteRule ^$ /index.php [L] +{% if zabbix_version is version('5.0', '<=') %} {% if zabbix_apache_include_custom_fragment | default(true) %} ## Custom fragment {% if zabbix_php_fpm %} @@ -145,5 +157,6 @@ SSLCryptoDevice {{ zabbix_apache_SSLCryptoDevice }} # Set correct timezone. php_value date.timezone {{ zabbix_timezone }} {% endif %} +{% endif %} {% endif %} diff --git a/roles/zabbix_web/templates/php-fpm.conf.j2 b/roles/zabbix_web/templates/php-fpm.conf.j2 new file mode 100644 index 000000000..f0c975fdc --- /dev/null +++ b/roles/zabbix_web/templates/php-fpm.conf.j2 @@ -0,0 +1,24 @@ +[zabbix] +user = apache +group = apache + +listen = {{ zabbix_php_fpm_dir_var }}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] = {{ zabbix_php_fpm_dir_var }}/lib/php/session/ + +php_value[max_execution_time] = {{ zabbix_web_max_execution_time | default('300') }} +php_value[memory_limit] = {{ zabbix_web_memory_limit | default('128M') }} +php_value[post_max_size] = {{ zabbix_web_post_max_size | default('16M') }} +php_value[upload_max_filesize] = {{ zabbix_web_upload_max_filesize | default('2M') }} +php_value[max_input_time] = {{ zabbix_web_max_input_time | default('300') }} +php_value[max_input_vars] = {{ zabbix_web_max_input_vars | default('10000') }} +php_value[date.timezone] = {{ zabbix_timezone }} From 9dd2189d3f7db902cfb738866a19dc1e02d9986e Mon Sep 17 00:00:00 2001 From: Werner Dijkerman Date: Tue, 14 Jul 2020 21:23:21 +0200 Subject: [PATCH 2/8] Minor updates to make it work on Debian --- roles/zabbix_web/templates/apache_vhost.conf.j2 | 15 ++++++++++++++- roles/zabbix_web/templates/php-fpm.conf.j2 | 2 +- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/roles/zabbix_web/templates/apache_vhost.conf.j2 b/roles/zabbix_web/templates/apache_vhost.conf.j2 index 98f32210e..8d236da62 100644 --- a/roles/zabbix_web/templates/apache_vhost.conf.j2 +++ b/roles/zabbix_web/templates/apache_vhost.conf.j2 @@ -30,9 +30,11 @@ DirectoryIndex index.php +{% if ansible_os_family == "Debian" %} - SetHandler "proxy:unix:/var/opt/rh/rh-php72/run/php-fpm/zabbix.sock|fcgi://localhost" + SetHandler "proxy:unix:{{ zabbix_php_fpm_dir_var }}/run/php-fpm/zabbix.sock|fcgi://localhost" +{% endif %} @@ -120,6 +122,17 @@ SSLCryptoDevice {{ zabbix_apache_SSLCryptoDevice }} Order Allow,Deny Allow from all {% endif %} + + + DirectoryIndex index.php + + +{% if ansible_os_family == "Debian" %} + + SetHandler "proxy:unix:{{ zabbix_php_fpm_dir_var }}/run/php-fpm/zabbix.sock|fcgi://localhost" + +{% endif %} + {% for my_path in directory_paths %} diff --git a/roles/zabbix_web/templates/php-fpm.conf.j2 b/roles/zabbix_web/templates/php-fpm.conf.j2 index f0c975fdc..b9fa4c910 100644 --- a/roles/zabbix_web/templates/php-fpm.conf.j2 +++ b/roles/zabbix_web/templates/php-fpm.conf.j2 @@ -2,7 +2,7 @@ user = apache group = apache -listen = {{ zabbix_php_fpm_dir_var }}run/php-fpm/zabbix.sock +listen = {{ zabbix_php_fpm_dir_var }}/run/php-fpm/zabbix.sock listen.acl_users = apache listen.allowed_clients = 127.0.0.1 From 41761bd842241e7ccb95cf23df2ac8d8c3c42ed0 Mon Sep 17 00:00:00 2001 From: Werner Dijkerman Date: Tue, 14 Jul 2020 21:25:13 +0200 Subject: [PATCH 3/8] The change is for RedHat not for Debian --- roles/zabbix_web/templates/apache_vhost.conf.j2 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/zabbix_web/templates/apache_vhost.conf.j2 b/roles/zabbix_web/templates/apache_vhost.conf.j2 index 8d236da62..022bb7de6 100644 --- a/roles/zabbix_web/templates/apache_vhost.conf.j2 +++ b/roles/zabbix_web/templates/apache_vhost.conf.j2 @@ -30,7 +30,7 @@ DirectoryIndex index.php -{% if ansible_os_family == "Debian" %} +{% if ansible_os_family == "RedHat" %} SetHandler "proxy:unix:{{ zabbix_php_fpm_dir_var }}/run/php-fpm/zabbix.sock|fcgi://localhost" @@ -127,7 +127,7 @@ SSLCryptoDevice {{ zabbix_apache_SSLCryptoDevice }} DirectoryIndex index.php -{% if ansible_os_family == "Debian" %} +{% if ansible_os_family == "RedHat" %} SetHandler "proxy:unix:{{ zabbix_php_fpm_dir_var }}/run/php-fpm/zabbix.sock|fcgi://localhost" From 8ae12e2508cdf1e5d7c2d36ce2a9857a800a7385 Mon Sep 17 00:00:00 2001 From: Werner Dijkerman Date: Tue, 14 Jul 2020 21:26:35 +0200 Subject: [PATCH 4/8] Using the correct Zabbix versions --- roles/zabbix_web/templates/apache_vhost.conf.j2 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/zabbix_web/templates/apache_vhost.conf.j2 b/roles/zabbix_web/templates/apache_vhost.conf.j2 index 022bb7de6..7cf8bf40a 100644 --- a/roles/zabbix_web/templates/apache_vhost.conf.j2 +++ b/roles/zabbix_web/templates/apache_vhost.conf.j2 @@ -59,7 +59,7 @@ RewriteEngine On RewriteRule ^$ /index.php [L] -{% if zabbix_version is version('5.0', '<=') %} +{% if zabbix_version is version('4.4', '<=') %} {% if zabbix_apache_include_custom_fragment | default(true) %} ## Custom fragment {% if zabbix_php_fpm %} @@ -156,7 +156,7 @@ SSLCryptoDevice {{ zabbix_apache_SSLCryptoDevice }} RewriteEngine On RewriteRule ^$ /index.php [L] -{% if zabbix_version is version('5.0', '<=') %} +{% if zabbix_version is version('4.4', '<=') %} {% if zabbix_apache_include_custom_fragment | default(true) %} ## Custom fragment {% if zabbix_php_fpm %} From e8cb50a0b25b83ecc810b2d4de4f2f894195aa86 Mon Sep 17 00:00:00 2001 From: Werner Dijkerman Date: Tue, 14 Jul 2020 21:48:32 +0200 Subject: [PATCH 5/8] Updating the documents to reflect on Zabbix 5.0 --- docs/ZABBIX_AGENT_ROLE.md | 8 ++++---- docs/ZABBIX_JAVAGATEWAY_ROLE.md | 20 ++++++++++---------- docs/ZABBIX_PROXY_ROLE.md | 20 ++++++++++---------- docs/ZABBIX_SERVER_ROLE.md | 20 ++++++++++---------- docs/ZABBIX_WEB_ROLE.md | 5 +++++ 5 files changed, 39 insertions(+), 34 deletions(-) diff --git a/docs/ZABBIX_AGENT_ROLE.md b/docs/ZABBIX_AGENT_ROLE.md index 6e7caeaa3..b886f8c37 100644 --- a/docs/ZABBIX_AGENT_ROLE.md +++ b/docs/ZABBIX_AGENT_ROLE.md @@ -56,10 +56,10 @@ See the following list of supported Operating systems with the Zabbix releases: | Zabbix | 5.0 | 4.4 | 4.0 (LTS) | 3.0 (LTS) | |---------------------|-----|-----|-----------|-----------| -| Red Hat Fam 8 | | V | | | -| Red Hat Fam 7 | | V | V | V | -| Red Hat Fam 6 | | | | V | -| Red Hat Fam 5 | | | | V | +| Red Hat Fam 8 | V | V | | | +| Red Hat Fam 7 | V | V | V | V | +| Red Hat Fam 6 | V | | | V | +| Red Hat Fam 5 | V | | | V | | Fedora | | V | V | | | Ubuntu 20.04 focal | V | | | | | Ubuntu 19.10 eoan | | | | | diff --git a/docs/ZABBIX_JAVAGATEWAY_ROLE.md b/docs/ZABBIX_JAVAGATEWAY_ROLE.md index 5cf032435..de0855469 100644 --- a/docs/ZABBIX_JAVAGATEWAY_ROLE.md +++ b/docs/ZABBIX_JAVAGATEWAY_ROLE.md @@ -31,19 +31,19 @@ See the following list of supported Operating systems with the Zabbix releases. | Zabbix | 5.0 | 4.4 | 4.0 (LTS) | 3.0 (LTS) | |---------------------|-----|-----|-----------|-----------| -| Red Hat Fam 8 | | V | | | -| Red Hat Fam 7 | | V | V | V | +| Red Hat Fam 8 | V | V | | | +| Red Hat Fam 7 | V | V | V | V | | Red Hat Fam 6 | | | | V | | Red Hat Fam 5 | | | | V | | Fedora | | V | V | | -| Ubuntu 20.04 focal | | | | | -| Ubuntu 19.10 eoan | | | | | -| Ubuntu 18.04 bionic | | V | V | | -| Ubuntu 16.04 xenial | | V | V | | -| Ubuntu 14.04 trusty | | V | V | V | -| Debian 10 buster | | V | | | -| Debian 9 stretch | | V | V | | -| Debian 8 jessie | | V | V | V | +| Ubuntu 20.04 focal | V | | | | +| Ubuntu 19.10 eoan | ? | | | | +| Ubuntu 18.04 bionic | V | V | V | | +| Ubuntu 16.04 xenial | V | V | V | | +| Ubuntu 14.04 trusty | V | V | V | V | +| Debian 10 buster | V | V | | | +| Debian 9 stretch | V | V | V | | +| Debian 8 jessie | V | V | V | V | | Debian 7 wheezy | | | V | V | | macOS 10.15 | | V | V | | | macOS 10.14 | | V | V | | diff --git a/docs/ZABBIX_PROXY_ROLE.md b/docs/ZABBIX_PROXY_ROLE.md index f07876cfd..fd166de65 100644 --- a/docs/ZABBIX_PROXY_ROLE.md +++ b/docs/ZABBIX_PROXY_ROLE.md @@ -34,19 +34,19 @@ See the following list of supported Operating systems with the Zabbix releases. | Zabbix | 5.0 | 4.4 | 4.0 (LTS) | 3.0 (LTS) | |---------------------|-----|-----|-----------|-----------| -| Red Hat Fam 8 | | V | | | -| Red Hat Fam 7 | | V | V | V | +| Red Hat Fam 8 | V | V | | | +| Red Hat Fam 7 | V | V | V | V | | Red Hat Fam 6 | | | | V | | Red Hat Fam 5 | | | | V | | Fedora | | V | V | | -| Ubuntu 20.04 focal | | | | | -| Ubuntu 19.10 eoan | | | | | -| Ubuntu 18.04 bionic | | V | V | | -| Ubuntu 16.04 xenial | | V | V | | -| Ubuntu 14.04 trusty | | V | V | V | -| Debian 10 buster | | V | | | -| Debian 9 stretch | | V | V | | -| Debian 8 jessie | | V | V | V | +| Ubuntu 20.04 focal | V | | | | +| Ubuntu 19.10 eoan | ? | | | | +| Ubuntu 18.04 bionic | V | V | V | | +| Ubuntu 16.04 xenial | V | V | V | | +| Ubuntu 14.04 trusty | V | V | V | V | +| Debian 10 buster | V | V | | | +| Debian 9 stretch | V | V | V | | +| Debian 8 jessie | V | V | V | V | | Debian 7 wheezy | | | V | V | | macOS 10.15 | | V | V | | | macOS 10.14 | | V | V | | diff --git a/docs/ZABBIX_SERVER_ROLE.md b/docs/ZABBIX_SERVER_ROLE.md index a42fe0088..31c9707c9 100644 --- a/docs/ZABBIX_SERVER_ROLE.md +++ b/docs/ZABBIX_SERVER_ROLE.md @@ -43,19 +43,19 @@ See the following list of supported Operating systems with the Zabbix releases: | Zabbix | 5.0 | 4.4 | 4.0 (LTS) | 3.0 (LTS) | |---------------------|-----|-----|-----------|-----------| -| Red Hat Fam 8 | | V | | | -| Red Hat Fam 7 | | V | V | V | +| Red Hat Fam 8 | V | V | | | +| Red Hat Fam 7 | V | V | V | V | | Red Hat Fam 6 | | | | V | | Red Hat Fam 5 | | | | V | | Fedora | | V | V | | -| Ubuntu 20.04 focal | | | | | -| Ubuntu 19.10 eoan | | | | | -| Ubuntu 18.04 bionic | | V | V | | -| Ubuntu 16.04 xenial | | V | V | | -| Ubuntu 14.04 trusty | | V | V | V | -| Debian 10 buster | | V | | | -| Debian 9 stretch | | V | V | | -| Debian 8 jessie | | V | V | V | +| Ubuntu 20.04 focal | V | | | | +| Ubuntu 19.10 eoan | ? | | | | +| Ubuntu 18.04 bionic | V | V | V | | +| Ubuntu 16.04 xenial | V | V | V | | +| Ubuntu 14.04 trusty | V | V | V | V | +| Debian 10 buster | V | V | | | +| Debian 9 stretch | V | V | V | | +| Debian 8 jessie | V | V | V | V | | Debian 7 wheezy | | | V | V | | macOS 10.15 | | V | V | | | macOS 10.14 | | V | V | | diff --git a/docs/ZABBIX_WEB_ROLE.md b/docs/ZABBIX_WEB_ROLE.md index bf68d9c6c..d8c57a2ef 100644 --- a/docs/ZABBIX_WEB_ROLE.md +++ b/docs/ZABBIX_WEB_ROLE.md @@ -105,6 +105,11 @@ The following is an overview of all available configuration defaults for this ro * `zabbix_apache_include_custom_fragment`: True / False. Includes php_value vars max_execution_time, memory_limit, post_max_size, upload_max_filesize, max_input_time and date.timezone in vhost file.. place those in php-fpm configuration. Default is true. * `zabbix_web_env`: (Optional) A Dictionary of PHP Environments +The following properties are specific to Zabbix 5.0: + +* `zabbix_php_fpm_dir_etc`: etc HOME root directory of PHP-FPM +* `zabbix_php_fpm_dir_var`: Var HOME root directory of PHP-FPM + The following properties are related when TLS/SSL is configured: * `zabbix_apache_tls`: If the Apache vhost should be configured with TLS encryption or not. From d66056b48aad2fa7b2d57a172a45799b8303cb9f Mon Sep 17 00:00:00 2001 From: Werner Dijkerman Date: Wed, 15 Jul 2020 20:17:00 +0200 Subject: [PATCH 6/8] Minor updates to the documentation --- docs/ZABBIX_AGENT_ROLE.md | 2 +- docs/ZABBIX_JAVAGATEWAY_ROLE.md | 2 +- docs/ZABBIX_PROXY_ROLE.md | 2 +- docs/ZABBIX_SERVER_ROLE.md | 2 +- docs/ZABBIX_WEB_ROLE.md | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/ZABBIX_AGENT_ROLE.md b/docs/ZABBIX_AGENT_ROLE.md index b886f8c37..e07036346 100644 --- a/docs/ZABBIX_AGENT_ROLE.md +++ b/docs/ZABBIX_AGENT_ROLE.md @@ -101,7 +101,7 @@ There are some variables in default/main.yml which can (or need to) be overridde * `zabbix_agent_serveractive`: The ip address for the zabbix-server or zabbix-proxy for active checks. -* `zabbix_agent_version`: This is the version of zabbix. Default it is 4.4, but can be overridden to one of the versions mentioned in [Zabbix Versions](#zabbix-versions). Previously the variable `zabbix_version` was used directly but it could cause [some inconvenience](https://github.com/dj-wasabi/ansible-zabbix-agent/pull/303). That variable is maintained by retrocompativility. +* `zabbix_agent_version`: This is the version of zabbix. Default it is 5.0, but can be overridden to one of the versions mentioned in [Zabbix Versions](#zabbix-versions). Previously the variable `zabbix_version` was used directly but it could cause [some inconvenience](https://github.com/dj-wasabi/ansible-zabbix-agent/pull/303). That variable is maintained by retrocompativility. * `zabbix_repo`: Default: _zabbix_ * _epel_ install agent from EPEL repo diff --git a/docs/ZABBIX_JAVAGATEWAY_ROLE.md b/docs/ZABBIX_JAVAGATEWAY_ROLE.md index de0855469..eb8ac5659 100644 --- a/docs/ZABBIX_JAVAGATEWAY_ROLE.md +++ b/docs/ZABBIX_JAVAGATEWAY_ROLE.md @@ -52,7 +52,7 @@ See the following list of supported Operating systems with the Zabbix releases. There are some variables in de default/main.yml which can (Or needs to) be changed/overriden: -* `zabbix_version`: This is the version of zabbix. Default it is 2.4, but can be overriden to 2.2 or 2.0. +* `zabbix_version`: This is the version of zabbix. Default: 5.0. Can be overridden to 4.4, 4.0, 3.4, 3.2, 3.0, 2.4, or 2.2. * `zabbix_repo`: True / False. When you already have an repository with the zabbix components, you can set it to False. diff --git a/docs/ZABBIX_PROXY_ROLE.md b/docs/ZABBIX_PROXY_ROLE.md index fd166de65..211b2523c 100644 --- a/docs/ZABBIX_PROXY_ROLE.md +++ b/docs/ZABBIX_PROXY_ROLE.md @@ -61,7 +61,7 @@ There are some variables in de default/main.yml which can (Or needs to) be chang * `zabbix_server_port`: The port on which the zabbix-server is running. Default: 10051 -* `zabbix_version`: This is the version of zabbix. Default it is 4.2, but can be overriden to 4.0/3.4/3.2/3.0/2.4/2.2. +* `zabbix_version`: This is the version of zabbix. Default it is 5.0, but can be overriden to 4.4/4.2/4.0/3.4/3.2/3.0/2.4/2.2. * `zabbix_proxy_{rhel,debian,ubuntu}_version`: This is the version of zabbix proxy. For example 4.4.4/4.2.5/4.2.8 diff --git a/docs/ZABBIX_SERVER_ROLE.md b/docs/ZABBIX_SERVER_ROLE.md index 31c9707c9..45eb925fd 100644 --- a/docs/ZABBIX_SERVER_ROLE.md +++ b/docs/ZABBIX_SERVER_ROLE.md @@ -79,7 +79,7 @@ The following is an overview of all available configuration default for this rol ### Overall Zabbix -* `zabbix_server_version`: This is the version of zabbix. Default: 4.4. Can be overridden to 3.2, 3.0, 2.4, or 2.2. Previously the variable `zabbix_version` was used directly but it could cause [some inconvenience](https://github.com/dj-wasabi/ansible-zabbix-agent/pull/303). That variable is maintained by retrocompativility. +* `zabbix_server_version`: This is the version of zabbix. Default: 5.0. Can be overridden to 4.4, 4.0, 3.4, 3.2, 3.0, 2.4, or 2.2. Previously the variable `zabbix_version` was used directly but it could cause [some inconvenience](https://github.com/dj-wasabi/ansible-zabbix-agent/pull/303). That variable is maintained by retrocompativility. * `zabbix_repo_yum`: A list with Yum repository configuration. * `zabbix_repo`: Default: _zabbix_ * _epel_ install agent from EPEL repo diff --git a/docs/ZABBIX_WEB_ROLE.md b/docs/ZABBIX_WEB_ROLE.md index d8c57a2ef..3c01c77ed 100644 --- a/docs/ZABBIX_WEB_ROLE.md +++ b/docs/ZABBIX_WEB_ROLE.md @@ -80,7 +80,7 @@ The following is an overview of all available configuration defaults for this ro ### Overall Zabbix -* `zabbix_web_version`: This is the version of zabbix. Default: 4.4, Can be overridden to 4.0, 3.4, 3.2, 3.0, 2.4, or 2.2. Previously the variable `zabbix_version` was used directly but it could cause [some inconvenience](https://github.com/dj-wasabi/ansible-zabbix-agent/pull/303). That variable is maintained by retrocompativility. +* `zabbix_web_version`: This is the version of zabbix. Default: 5.0, Can be overridden to 4.4, 4.0, 3.4, 3.2, 3.0, 2.4, or 2.2. Previously the variable `zabbix_version` was used directly but it could cause [some inconvenience](https://github.com/dj-wasabi/ansible-zabbix-agent/pull/303). That variable is maintained by retrocompativility. * `zabbix_repo_yum`: A list with Yum repository configuration. * `zabbix_web_package_state`: Default: _present_. Can be overridden to "latest" to update packages when needed. * `zabbix_web_centos_release`: Default: False. When the `centos-release-scl` repository needs to be enabled. This is required when using Zabbix 5.0 due to installation of a recent version of `PHP`. From 4c4da332210618c3881def91bfcc9383709ebcf4 Mon Sep 17 00:00:00 2001 From: Werner Dijkerman Date: Sat, 25 Jul 2020 16:54:53 +0200 Subject: [PATCH 7/8] Added missing task about selinux, so server,web and proxy have same task --- roles/zabbix_proxy/tasks/RedHat.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/roles/zabbix_proxy/tasks/RedHat.yml b/roles/zabbix_proxy/tasks/RedHat.yml index 54c6a7da5..6db7337cd 100644 --- a/roles/zabbix_proxy/tasks/RedHat.yml +++ b/roles/zabbix_proxy/tasks/RedHat.yml @@ -19,6 +19,17 @@ tags: - zabbix-proxy +- name: "RedHat | Set facts for Zabbix >= 3.0 and RedHat 8" + set_fact: + apache_log: httpd + datafiles_path: "/usr/share/doc/zabbix-proxy-{{ zabbix_proxy_database }}" + when: + - zabbix_version is version_compare('3.0', '>=') + - ansible_distribution_major_version == '8' + - zabbix_proxy_database == 'sqlite3' + tags: + - zabbix-proxy + - name: "Make sure old file is absent" file: path: /etc/yum.repos.d/zabbix-supported.repo @@ -126,6 +137,8 @@ yum: name: - policycoreutils-python + - libsemanage-python + - checkpolicy state: present register: zabbix_server_dependencies_installed until: zabbix_server_dependencies_installed is succeeded From 0a3f84e8b777edaf3a05f31cecfc61ac212b5e07 Mon Sep 17 00:00:00 2001 From: Werner Dijkerman Date: Sat, 25 Jul 2020 16:55:05 +0200 Subject: [PATCH 8/8] Made it work on CentOS 8 --- roles/zabbix_web/tasks/RedHat.yml | 5 ++++- roles/zabbix_web/tasks/apache_RedHat.yml | 20 +++++++++++++++++-- .../zabbix_web/templates/apache_vhost.conf.j2 | 4 ++-- roles/zabbix_web/templates/php-fpm.conf.j2 | 6 +++--- 4 files changed, 27 insertions(+), 8 deletions(-) diff --git a/roles/zabbix_web/tasks/RedHat.yml b/roles/zabbix_web/tasks/RedHat.yml index c9c96c911..b55afb79e 100644 --- a/roles/zabbix_web/tasks/RedHat.yml +++ b/roles/zabbix_web/tasks/RedHat.yml @@ -27,6 +27,7 @@ when: - zabbix_repo == "zabbix" - zabbix_version is version('5.0', '>=') + - ansible_distribution_major_version != '8' tags: - zabbix-web @@ -41,6 +42,7 @@ when: - zabbix_version is version('5.0', '>=') - zabbix_web_centos_release + - ansible_distribution_major_version != '8' tags: - zabbix-web @@ -54,12 +56,13 @@ until: zabbix_web_package_install is succeeded when: - zabbix_version is version('5.0', '>=') + - ansible_distribution_major_version != '8' tags: - zabbix-web - name: "RedHat | Install zabbix-web-{{ zabbix_server_database }}" yum: - pkg: zabbix-web-{{ zabbix_server_database }}{{ '-scl' if zabbix_version is version('5.0', '>=') }} + pkg: zabbix-web-{{ zabbix_server_database }}{{ '-scl' if zabbix_version is version('5.0', '>=') and ansible_distribution_major_version != '8'}} state: "{{ zabbix_web_package_state }}" update_cache: yes register: zabbix_web_package_install diff --git a/roles/zabbix_web/tasks/apache_RedHat.yml b/roles/zabbix_web/tasks/apache_RedHat.yml index 79208d30a..24ce7fe04 100644 --- a/roles/zabbix_web/tasks/apache_RedHat.yml +++ b/roles/zabbix_web/tasks/apache_RedHat.yml @@ -1,13 +1,29 @@ --- +- name: "Set FPM path" + set_fact: + php_fpm_dir: "{{ zabbix_php_fpm_dir_etc }}" + php_fpm_session: "{{ zabbix_php_fpm_dir_var }}/lib/php/session/" + php_fpm_listen: "{{ zabbix_php_fpm_dir_var }}/run/php-fpm" + +- name: "Override FPM path CentOS 8" + set_fact: + php_fpm_dir: /etc + php_fpm_session: /var/lib/php/session + php_fpm_listen: "/run/php-fpm" + when: + - ansible_distribution_major_version == '8' + - name: "RedHat | Install PHP" template: src: php-fpm.conf.j2 - dest: "{{ zabbix_php_fpm_dir_etc }}/php-fpm.d/zabbix.conf" + dest: "{{ php_fpm_dir }}/php-fpm.d/zabbix.conf" owner: "{{ apache_user }}" group: "{{ apache_group }}" mode: 0644 - when: zabbix_vhost + when: + - zabbix_vhost + - ansible_distribution_major_version != '8' notify: - restart rh-php72-php-fpm diff --git a/roles/zabbix_web/templates/apache_vhost.conf.j2 b/roles/zabbix_web/templates/apache_vhost.conf.j2 index 7cf8bf40a..e47fa5274 100644 --- a/roles/zabbix_web/templates/apache_vhost.conf.j2 +++ b/roles/zabbix_web/templates/apache_vhost.conf.j2 @@ -30,7 +30,7 @@ DirectoryIndex index.php -{% if ansible_os_family == "RedHat" %} +{% if ansible_os_family == "RedHat" and ansible_distribution_major_version is version('7', '<=') %} SetHandler "proxy:unix:{{ zabbix_php_fpm_dir_var }}/run/php-fpm/zabbix.sock|fcgi://localhost" @@ -127,7 +127,7 @@ SSLCryptoDevice {{ zabbix_apache_SSLCryptoDevice }} DirectoryIndex index.php -{% if ansible_os_family == "RedHat" %} +{% if ansible_os_family == "RedHat" and ansible_distribution_major_version is version('7', '<=') %} SetHandler "proxy:unix:{{ zabbix_php_fpm_dir_var }}/run/php-fpm/zabbix.sock|fcgi://localhost" diff --git a/roles/zabbix_web/templates/php-fpm.conf.j2 b/roles/zabbix_web/templates/php-fpm.conf.j2 index b9fa4c910..cb29131eb 100644 --- a/roles/zabbix_web/templates/php-fpm.conf.j2 +++ b/roles/zabbix_web/templates/php-fpm.conf.j2 @@ -2,8 +2,8 @@ user = apache group = apache -listen = {{ zabbix_php_fpm_dir_var }}/run/php-fpm/zabbix.sock -listen.acl_users = apache +listen = {{ php_fpm_listen }}/zabbix.sock +listen.acl_users = apache,nginx listen.allowed_clients = 127.0.0.1 pm = dynamic @@ -13,7 +13,7 @@ pm.min_spare_servers = 5 pm.max_spare_servers = 35 php_value[session.save_handler] = files -php_value[session.save_path] = {{ zabbix_php_fpm_dir_var }}/lib/php/session/ +php_value[session.save_path] = {{ php_fpm_session }} php_value[max_execution_time] = {{ zabbix_web_max_execution_time | default('300') }} php_value[memory_limit] = {{ zabbix_web_memory_limit | default('128M') }}