diff --git a/molecule/zabbix_server/prepare.yml b/molecule/zabbix_server/prepare.yml index 56b79d12d..725e6d718 100644 --- a/molecule/zabbix_server/prepare.yml +++ b/molecule/zabbix_server/prepare.yml @@ -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' diff --git a/roles/zabbix_server/tasks/initialize-mysql.yml b/roles/zabbix_server/tasks/initialize-mysql.yml index 0773c82db..c3fd67c6d 100644 --- a/roles/zabbix_server/tasks/initialize-mysql.yml +++ b/roles/zabbix_server/tasks/initialize-mysql.yml @@ -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" diff --git a/roles/zabbix_server/tasks/initialize-pgsql.yml b/roles/zabbix_server/tasks/initialize-pgsql.yml index 3ec8163d9..65bd0beec 100644 --- a/roles/zabbix_server/tasks/initialize-pgsql.yml +++ b/roles/zabbix_server/tasks/initialize-pgsql.yml @@ -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: | diff --git a/roles/zabbix_server/tasks/main.yml b/roles/zabbix_server/tasks/main.yml index 73002237c..356403e0b 100644 --- a/roles/zabbix_server/tasks/main.yml +++ b/roles/zabbix_server/tasks/main.yml @@ -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) }}" diff --git a/roles/zabbix_server/templates/zabbix_server.conf.j2 b/roles/zabbix_server/templates/zabbix_server.conf.j2 index 0631e001a..489e9c9f5 100644 --- a/roles/zabbix_server/templates/zabbix_server.conf.j2 +++ b/roles/zabbix_server/templates/zabbix_server.conf.j2 @@ -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('') }} @@ -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('') }} @@ -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('') }} diff --git a/roles/zabbix_server/vars/Debian.yml b/roles/zabbix_server/vars/Debian.yml index 4d488fdf1..75f3751c2 100644 --- a/roles/zabbix_server/vars/Debian.yml +++ b/roles/zabbix_server/vars/Debian.yml @@ -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 diff --git a/roles/zabbix_server/vars/RedHat.yml b/roles/zabbix_server/vars/RedHat.yml index 21045a5b3..fb20631f8 100644 --- a/roles/zabbix_server/vars/RedHat.yml +++ b/roles/zabbix_server/vars/RedHat.yml @@ -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