Skip to content

Commit

Permalink
Drop zabbix 5.0 compatability
Browse files Browse the repository at this point in the history
This simplifies the code by removing zabbix-5.0 quirks/workarounds.
  • Loading branch information
eb4x authored and pyrodie18 committed May 12, 2024
1 parent 6ab3157 commit d5bfac2
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 40 deletions.
14 changes: 0 additions & 14 deletions molecule/zabbix_server/prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,17 +109,3 @@
state: absent
when:
- ansible_os_family == 'RedHat'

# On certain Ubuntu container images, dpkg is configured not to
# install files into paths /usr/share/doc/*
# Since this is where Zabbix 5.0 installs its database schemas, we need to allow
# files to be installed to /usr/share/doc/zabbix-server-*
- name: "Ubuntu | Allow Zabbix dpkg installs to /usr/share/doc/zabbix-server-*"
ansible.builtin.lineinfile:
path: /etc/dpkg/dpkg.cfg.d/excludes
create: true
line: 'path-include=/usr/share/doc/zabbix\-server\-*'
become: true
when:
- zabbix_server_version is version('6.0', '<')
- ansible_facts['distribution'] == 'Ubuntu'
6 changes: 1 addition & 5 deletions roles/zabbix_server/tasks/initialize-mysql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,7 @@
encoding: "{{ zabbix_server_dbencoding }}"
collation: "{{ zabbix_server_dbcollation }}"
state: import
target: "{{ is_legacy_version | ternary(legacy_path, modern_path) }}"
vars:
is_legacy_version: "{{ zabbix_server_version is version('6.0', '<') }}"
legacy_path: /usr/share/doc/zabbix-server-mysql/create.sql.gz
modern_path: /usr/share/zabbix-sql-scripts/mysql/server.sql.gz
target: /usr/share/zabbix-sql-scripts/mysql/server.sql.gz

always:
- name: "MySQL | Revert variable overrides for schema import"
Expand Down
6 changes: 1 addition & 5 deletions roles/zabbix_server/tasks/initialize-pgsql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,7 @@
port: "{{ zabbix_server_dbport }}"
db: "{{ zabbix_server_dbname }}"
state: restore
target: "{{ is_legacy_version | ternary(legacy_path, modern_path) }}"
vars:
is_legacy_version: "{{ zabbix_server_version is version('6.0', '<') }}"
legacy_path: /usr/share/doc/zabbix-server-pgsql/create.sql.gz
modern_path: /usr/share/zabbix-sql-scripts/postgresql/server.sql.gz
target: /usr/share/zabbix-sql-scripts/postgresql/server.sql.gz

- name: "PostgreSQL | Create TimescaleDB hypertables"
ansible.builtin.shell: |
Expand Down
7 changes: 1 addition & 6 deletions roles/zabbix_server/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,11 @@

- name: Install zabbix-server packages
ansible.builtin.package:
name: "{{ item.name }}"
name: "{{ _zabbix_server_packages }}"
state: "{{ zabbix_server_package_state }}"
update_cache: true
disablerepo: "{{ zabbix_server_disable_repo | default(_zabbix_server_disable_repo | default(omit)) }}"
install_recommends: "{{ zabbix_server_install_recommends | default(_zabbix_server_install_recommends | default(omit)) }}"
when: item.required | default(true)
loop:
- name: "{{ zabbix_server_package | default(_zabbix_server_package) }}"
- required: "{{ zabbix_server_version is version('6.0', '>=') }}"
name: "{{ _zabbix_server_sql_scripts_package }}"
environment:
http_proxy: "{{ zabbix_http_proxy | default(None) | default(omit) }}"
https_proxy: "{{ zabbix_https_proxy | default(None) | default(omit) }}"
Expand Down
6 changes: 0 additions & 6 deletions roles/zabbix_server/templates/zabbix_server.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@

{{ (zabbix_server_alertscriptspath is defined and zabbix_server_alertscriptspath is not none) | ternary('', '# ') }}AlertScriptsPath={{ zabbix_server_alertscriptspath | default('') }}
{{ (zabbix_server_allowroot is defined and zabbix_server_allowroot is not none) | ternary('', '# ') }}AllowRoot={{ zabbix_server_allowroot | default('') }}
{% if zabbix_server_version is version('6.0', '>=') %}
{{ (zabbix_server_allowunsupporteddbversions is defined and zabbix_server_allowunsupporteddbversions is not none) | ternary('', '# ') }}AllowUnsupportedDBVersions={{ zabbix_server_allowunsupporteddbversions | default('') }}
{% endif %}
{{ (zabbix_server_cachesize is defined and zabbix_server_cachesize is not none) | ternary('', '# ') }}CacheSize={{ zabbix_server_cachesize | default('') }}
{{ (zabbix_server_cacheupdatefrequency is defined and zabbix_server_cacheupdatefrequency is not none) | ternary('', '# ') }}CacheUpdateFrequency={{ zabbix_server_cacheupdatefrequency | default('') }}
{{ (zabbix_server_dbhost is defined and zabbix_server_dbhost is not none) | ternary('', '# ') }}DBHost={{ zabbix_server_dbhost | default('') }}
Expand Down Expand Up @@ -79,9 +77,7 @@
{{ (zabbix_server_startpollersunreachable is defined and zabbix_server_startpollersunreachable is not none) | ternary('', '# ') }}StartPollersUnreachable={{ zabbix_server_startpollersunreachable | default('') }}
{{ (zabbix_server_startpreprocessors is defined and zabbix_server_startpreprocessors is not none) | ternary('', '# ') }}StartPreprocessors={{ zabbix_server_startpreprocessors | default('') }}
{{ (zabbix_server_startproxypollers is defined and zabbix_server_startproxypollers is not none) | ternary('', '# ') }}StartProxyPollers={{ zabbix_server_startproxypollers | default('') }}
{% if zabbix_server_version is version('6.0', '>=') %}
{{ (zabbix_server_startreportwriters is defined and zabbix_server_startreportwriters is not none) | ternary('', '# ') }}StartReportWriters={{ zabbix_server_startreportwriters | default('') }}
{% endif %}
{{ (zabbix_server_startsnmptrapper is defined and zabbix_server_startsnmptrapper is not none) | ternary('', '# ') }}StartSNMPTrapper={{ zabbix_server_startsnmptrapper | default('') }}
{{ (zabbix_server_starttimers is defined and zabbix_server_starttimers is not none) | ternary('', '# ') }}StartTimers={{ zabbix_server_starttimers | default('') }}
{{ (zabbix_server_starttrappers is defined and zabbix_server_starttrappers is not none) | ternary('', '# ') }}StartTrappers={{ zabbix_server_starttrappers | default('') }}
Expand Down Expand Up @@ -119,9 +115,7 @@
{{ (zabbix_server_vaulttlscertfile is defined and zabbix_server_vaulttlscertfile is not none) | ternary('', '# ') }}VaultTLSCertFile={{ zabbix_server_vaulttlscertfile | default('') }}
{% endif %}
{{ (zabbix_server_vaulttoken is defined and zabbix_server_vaulttoken is not none) | ternary('', '# ') }}VaultToken={{ zabbix_server_vaulttoken | default('') }}
{% if zabbix_server_version is version('6.0', '>=') %}
{{ (zabbix_server_vaulturl is defined and zabbix_server_vaulturl is not none) | ternary('', '# ') }}VaultURL={{ zabbix_server_vaulturl | default('') }}
{% endif %}
{{ (zabbix_server_vmwarecachesize is defined and zabbix_server_vmwarecachesize is not none) | ternary('', '# ') }}VMwareCacheSize={{ zabbix_server_vmwarecachesize | default('') }}
{{ (zabbix_server_vmwarefrequency is defined and zabbix_server_vmwarefrequency is not none) | ternary('', '# ') }}VMwareFrequency={{ zabbix_server_vmwarefrequency | default('') }}
{{ (zabbix_server_vmwareperffrequency is defined and zabbix_server_vmwareperffrequency is not none) | ternary('', '# ') }}VMwarePerfFrequency={{ zabbix_server_vmwareperffrequency | default('') }}
Expand Down
5 changes: 3 additions & 2 deletions roles/zabbix_server/vars/Debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ _zabbix_server_mysql_dependencies:
_zabbix_server_fping6location: /usr/bin/fping6
_zabbix_server_fpinglocation: /usr/bin/fping

_zabbix_server_package: "zabbix-server-{{ zabbix_server_database }}"
_zabbix_server_sql_scripts_package: "zabbix-sql-scripts"
_zabbix_server_packages:
- "zabbix-server-{{ zabbix_server_database }}"
- "zabbix-sql-scripts"
_zabbix_server_install_recommends: true
5 changes: 3 additions & 2 deletions roles/zabbix_server/vars/RedHat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ _zabbix_server_mysql_dependencies:
_zabbix_server_fping6location: /usr/sbin/fping6
_zabbix_server_fpinglocation: /usr/sbin/fping

_zabbix_server_package: "zabbix-server-{{ zabbix_server_database }}-{{ zabbix_server_version }}.{{ zabbix_server_version_minor }}"
_zabbix_server_sql_scripts_package: "zabbix-sql-scripts-{{ zabbix_server_version }}.{{ zabbix_server_version_minor }}"
_zabbix_server_packages:
- "zabbix-server-{{ zabbix_server_database }}-{{ zabbix_server_version }}.{{ zabbix_server_version_minor }}"
- "zabbix-sql-scripts-{{ zabbix_server_version }}.{{ zabbix_server_version_minor }}"
_zabbix_server_disable_repo:
- epel

0 comments on commit d5bfac2

Please sign in to comment.