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 committed May 5, 2024
1 parent cacb0ea commit 1a2d811
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 57 deletions.
16 changes: 0 additions & 16 deletions molecule/zabbix_proxy/prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,19 +95,3 @@
dest: /etc/sudoers
line: "Defaults !requiretty"
state: present

- name: "Make sure the docs can be installed. (RedHat)"
ansible.builtin.lineinfile:
dest: /etc/yum.conf
line: "tsflags=nodocs"
state: absent
when:
- ansible_os_family == 'RedHat'

- name: "Make sure the docs can be installed. (Debian)"
ansible.builtin.lineinfile:
path: /etc/dpkg/dpkg.cfg.d/excludes
state: absent
regexp: "path-exclude=/usr/share/doc/*"
when:
- ansible_os_family != 'RedHat'
6 changes: 1 addition & 5 deletions roles/zabbix_proxy/tasks/initialize-mysql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,7 @@
encoding: "{{ zabbix_proxy_dbencoding }}"
collation: "{{ zabbix_proxy_dbcollation }}"
state: import
target: "{{ is_legacy_version | ternary(legacy_path, modern_path) }}"
vars:
is_legacy_version: "{{ zabbix_proxy_version is version('6.0', '<') }}"
legacy_path: "{{ ls_output_schema.stdout }}"
modern_path: /usr/share/zabbix-sql-scripts/mysql/proxy.sql
target: /usr/share/zabbix-sql-scripts/mysql/proxy.sql

always:
- name: "MySQL | Revert variable overrides for schema import"
Expand Down
6 changes: 1 addition & 5 deletions roles/zabbix_proxy/tasks/initialize-pgsql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,4 @@
port: "{{ zabbix_proxy_dbport }}"
db: "{{ zabbix_proxy_dbname }}"
state: restore
target: "{{ is_legacy_version | ternary(legacy_path, modern_path) }}"
vars:
is_legacy_version: "{{ zabbix_proxy_version is version('6.0', '<') }}"
legacy_path: "{{ ls_output_schema.stdout }}"
modern_path: /usr/share/zabbix-sql-scripts/postgresql/proxy.sql
target: /usr/share/zabbix-sql-scripts/postgresql/proxy.sql
6 changes: 1 addition & 5 deletions roles/zabbix_proxy/tasks/initialize-sqlite3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,10 @@
become_user: "{{ zabbix_os_user }}"
ansible.builtin.shell: |
set -euxo pipefail
{{ is_legacy_version | ternary(legacy_command, modern_command) }}
sqlite3 {{ zabbix_proxy_dbname }} < /usr/share/zabbix-sql-scripts/sqlite3/proxy.sql
args:
creates: "{{ zabbix_proxy_dbname }}"
executable: /bin/bash
vars:
is_legacy_version: "{{ zabbix_proxy_version is version('6.0', '<') }}"
legacy_command: zcat {{ ls_output_schema.stdout }} | sqlite3 {{ zabbix_proxy_dbname }}
modern_command: cat /usr/share/zabbix-sql-scripts/sqlite3/proxy.sql | sqlite3 {{ zabbix_proxy_dbname }}

- name: "Sqlite3 | Fix zabbix db file permission (SELinux)"
when: ansible_selinux.status == "enabled"
Expand Down
17 changes: 1 addition & 16 deletions roles/zabbix_proxy/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,10 @@

- name: "Install zabbix-proxy packages"
ansible.builtin.package:
name: "{{ item.name }}"
name: "{{ _zabbix_proxy_packages }}"
state: "{{ zabbix_proxy_package_state }}"
update_cache: true
disablerepo: "{{ zabbix_proxy_disable_repo | default(_zabbix_proxy_disable_repo | default(omit)) }}"
when: item.required | default(true)
loop:
- name: "{{ _zabbix_proxy_package }}"
- required: "{{ zabbix_proxy_version is version('6.0', '>=') }}"
name: "{{ _zabbix_proxy_sql_scripts_package }}"
environment:
http_proxy: "{{ zabbix_http_proxy | default(None) | default(omit) }}"
https_proxy: "{{ zabbix_https_proxy | default(None) | default(omit) }}"
Expand All @@ -68,16 +63,6 @@
tags:
- install

- name: "Get legacy file-path for database schema"
when:
- zabbix_proxy_database_sqlload
- zabbix_proxy_version is version('6.0', '<')
ansible.builtin.shell: "ls -1 /usr/share/doc/zabbix-proxy-{{ zabbix_proxy_database }}*/schema.sql.gz"
changed_when: false
register: ls_output_schema
tags:
- database

- name: "Initialize the database"
ansible.builtin.include_tasks: "initialize-{{ zabbix_proxy_database }}.yml"

Expand Down
6 changes: 0 additions & 6 deletions roles/zabbix_proxy/templates/zabbix_proxy.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
# https://www.zabbix.com/documentation/{{ zabbix_proxy_version }}/en/manual/appendix/config/zabbix_proxy

{{ (zabbix_proxy_allowroot is defined and zabbix_proxy_allowroot is not none) | ternary('','# ') }}AllowRoot={{ zabbix_proxy_allowroot | default('') }}
{% if zabbix_proxy_version is version('6.0', '>=') %}
{{ (zabbix_proxy_allowunsupporteddbversions is defined and zabbix_proxy_allowunsupporteddbversions is not none) | ternary('','# ') }}AllowUnsupportedDBVersions={{ zabbix_proxy_allowunsupporteddbversions | default('') }}
{% endif %}
{{ (zabbix_proxy_cachesize is defined and zabbix_proxy_cachesize is not none) | ternary('','# ') }}CacheSize={{ zabbix_proxy_cachesize | default('') }}
{{ (zabbix_proxy_configfrequency is defined and zabbix_proxy_configfrequency is not none) | ternary('','# ') }}ConfigFrequency={{ zabbix_proxy_configfrequency | default('') }}
{{ (zabbix_proxy_datasenderfrequency is defined and zabbix_proxy_datasenderfrequency is not none) | ternary('','# ') }}DataSenderFrequency={{ zabbix_proxy_datasenderfrequency | default('') }}
Expand Down Expand Up @@ -71,9 +69,7 @@
{{ (zabbix_proxy_starthttppollers is defined and zabbix_proxy_starthttppollers is not none) | ternary('','# ') }}StartHTTPPollers={{ zabbix_proxy_starthttppollers | default('') }}
{{ (zabbix_proxy_startipmipollers is defined and zabbix_proxy_startipmipollers is not none) | ternary('','# ') }}StartIPMIPollers={{ zabbix_proxy_startipmipollers | default('') }}
{{ (zabbix_proxy_startjavapollers is defined and zabbix_proxy_startjavapollers is not none) | ternary('','# ') }}StartJavaPollers={{ zabbix_proxy_startjavapollers | default('') }}
{% if zabbix_proxy_version is version('6.0', '>=') %}
{{ (zabbix_proxy_startodbcpollers is defined and zabbix_proxy_startodbcpollers is not none) | ternary('','# ') }}StartODBCPollers={{ zabbix_proxy_startodbcpollers | default('') }}
{% endif %}
{{ (zabbix_proxy_startpingers is defined and zabbix_proxy_startpingers is not none) | ternary('','# ') }}StartPingers={{ zabbix_proxy_startpingers | default('') }}
{{ (zabbix_proxy_startpollers is defined and zabbix_proxy_startpollers is not none) | ternary('','# ') }}StartPollers={{ zabbix_proxy_startpollers | default('') }}
{{ (zabbix_proxy_startpollersunreachable is defined and zabbix_proxy_startpollersunreachable is not none) | ternary('','# ') }}StartPollersUnreachable={{ zabbix_proxy_startpollersunreachable | default('') }}
Expand Down Expand Up @@ -114,9 +110,7 @@
{{ (zabbix_proxy_vaulttlskeyfile is defined and zabbix_proxy_vaulttlskeyfile is not none) | ternary('','# ') }}VaultTLSKeyFile={{ zabbix_proxy_vaulttlskeyfile | default('') }}
{% endif %}
{{ (zabbix_proxy_vaulttoken is defined and zabbix_proxy_vaulttoken is not none) | ternary('','# ') }}VaultToken={{ zabbix_proxy_vaulttoken | default('') }}
{% if zabbix_proxy_version is version('6.0', '>=') %}
{{ (zabbix_proxy_vaulturl is defined and zabbix_proxy_vaulturl is not none) | ternary('','# ') }}VaultURL={{ zabbix_proxy_vaulturl | default('') }}
{% endif %}
{{ (zabbix_proxy_vmwarecachesize is defined and zabbix_proxy_vmwarecachesize is not none) | ternary('','# ') }}VMwareCacheSize={{ zabbix_proxy_vmwarecachesize | default('') }}
{{ (zabbix_proxy_vmwarefrequency is defined and zabbix_proxy_vmwarefrequency is not none) | ternary('','# ') }}VMwareFrequency={{ zabbix_proxy_vmwarefrequency | default('') }}
{{ (zabbix_proxy_vmwareperffrequency is defined and zabbix_proxy_vmwareperffrequency is not none) | ternary('','# ') }}VMwarePerfFrequency={{ zabbix_proxy_vmwareperffrequency | default('') }}
Expand Down
5 changes: 3 additions & 2 deletions roles/zabbix_proxy/vars/Debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,6 @@ zabbix_gpg_key: "{{ debian_keyring_path }}zabbix-repo.asc"
_zabbix_proxy_fping6location: /usr/bin/fping6
_zabbix_proxy_fpinglocation: /usr/bin/fping

_zabbix_proxy_package: "zabbix-proxy-{{ zabbix_proxy_database }}"
_zabbix_proxy_sql_scripts_package: "zabbix-sql-scripts"
_zabbix_proxy_packages:
- "zabbix-proxy-{{ zabbix_proxy_database }}"
- "zabbix-sql-scripts"
5 changes: 3 additions & 2 deletions roles/zabbix_proxy/vars/RedHat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ mysql_plugin:
_zabbix_proxy_fping6location: /usr/sbin/fping6
_zabbix_proxy_fpinglocation: /usr/sbin/fping

_zabbix_proxy_package: "zabbix-proxy-{{ zabbix_proxy_database }}-{{ zabbix_proxy_version }}.{{ zabbix_proxy_version_minor }}"
_zabbix_proxy_sql_scripts_package: "zabbix-sql-scripts-{{ zabbix_proxy_version }}.{{ zabbix_proxy_version_minor }}"
_zabbix_proxy_packages:
- "zabbix-proxy-{{ zabbix_proxy_database }}-{{ zabbix_proxy_version }}.{{ zabbix_proxy_version_minor }}"
- "zabbix-sql-scripts-{{ zabbix_proxy_version }}.{{ zabbix_proxy_version_minor }}"

_zabbix_proxy_disable_repo:
- epel

0 comments on commit 1a2d811

Please sign in to comment.