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

Update to zabbix 50 #131

Merged
merged 10 commits into from
Jul 26, 2020
10 changes: 5 additions & 5 deletions docs/ZABBIX_AGENT_ROLE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 | | | | |
Expand Down Expand Up @@ -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
Expand Down
22 changes: 11 additions & 11 deletions docs/ZABBIX_JAVAGATEWAY_ROLE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 | |
Expand All @@ -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.

Expand Down
22 changes: 11 additions & 11 deletions docs/ZABBIX_PROXY_ROLE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 | |
Expand All @@ -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

Expand Down
22 changes: 11 additions & 11 deletions docs/ZABBIX_SERVER_ROLE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 | |
Expand All @@ -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
Expand Down
8 changes: 7 additions & 1 deletion docs/ZABBIX_WEB_ROLE.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,10 @@ 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`.

### Zabbix Web specific

Expand All @@ -104,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.
Expand Down
2 changes: 1 addition & 1 deletion roles/zabbix_javagateway/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
3 changes: 2 additions & 1 deletion roles/zabbix_proxy/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -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.

Expand Down
2 changes: 1 addition & 1 deletion roles/zabbix_server/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
16 changes: 14 additions & 2 deletions roles/zabbix_web/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
9 changes: 9 additions & 0 deletions roles/zabbix_web/handlers/main.yml
Original file line number Diff line number Diff line change
@@ -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', '>=')
44 changes: 43 additions & 1 deletion roles/zabbix_web/tasks/RedHat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 12 additions & 0 deletions roles/zabbix_web/tasks/apache_RedHat.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
26 changes: 26 additions & 0 deletions roles/zabbix_web/templates/apache_vhost.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,17 @@
Order Allow,Deny
Allow from all
{% endif %}

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

{% if ansible_os_family == "RedHat" %}
<FilesMatch \.(php|phar)$>
SetHandler "proxy:unix:{{ zabbix_php_fpm_dir_var }}/run/php-fpm/zabbix.sock|fcgi://localhost"
</FilesMatch>
{% endif %}

</Directory>

{% for my_path in directory_paths %}
Expand All @@ -48,6 +59,7 @@
RewriteEngine On
RewriteRule ^$ /index.php [L]

{% if zabbix_version is version('4.4', '<=') %}
{% if zabbix_apache_include_custom_fragment | default(true) %}
## Custom fragment
{% if zabbix_php_fpm %}
Expand All @@ -63,6 +75,7 @@
php_value date.timezone {{ zabbix_timezone }}
{% endif %}
{% endif %}
{% endif %}
</VirtualHost>

{# Set up TLS vhosts #}
Expand Down Expand Up @@ -109,6 +122,17 @@ SSLCryptoDevice {{ zabbix_apache_SSLCryptoDevice }}
Order Allow,Deny
Allow from all
{% endif %}

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

{% if ansible_os_family == "RedHat" %}
<FilesMatch \.(php|phar)$>
SetHandler "proxy:unix:{{ zabbix_php_fpm_dir_var }}/run/php-fpm/zabbix.sock|fcgi://localhost"
</FilesMatch>
{% endif %}

</Directory>

{% for my_path in directory_paths %}
Expand All @@ -132,6 +156,7 @@ SSLCryptoDevice {{ zabbix_apache_SSLCryptoDevice }}
RewriteEngine On
RewriteRule ^$ /index.php [L]

{% if zabbix_version is version('4.4', '<=') %}
{% if zabbix_apache_include_custom_fragment | default(true) %}
## Custom fragment
{% if zabbix_php_fpm %}
Expand All @@ -147,5 +172,6 @@ SSLCryptoDevice {{ zabbix_apache_SSLCryptoDevice }}
php_value date.timezone {{ zabbix_timezone }}
{% endif %}
{% endif %}
{% endif %}
</VirtualHost>
{% endif %}
Loading