From 5c8c885feae88995128e0f2cc0c163140fadf560 Mon Sep 17 00:00:00 2001 From: Erik Berg Date: Fri, 10 May 2024 00:14:19 +0200 Subject: [PATCH] Enable skipping versions check (#1224) These tables are incomplete, and a hinderance for deployments to valid combinations. Allow the user to bypass this by supplying `-e enable_version_check=false` --- .../fragments/1224-enable-version-check.yml | 2 ++ docs/ZABBIX_AGENT_ROLE.md | 1 + docs/ZABBIX_JAVAGATEWAY_ROLE.md | 2 ++ docs/ZABBIX_PROXY_ROLE.md | 2 ++ docs/ZABBIX_SERVER_ROLE.md | 2 ++ docs/ZABBIX_WEB_ROLE.md | 2 ++ roles/zabbix_agent/tasks/main.yml | 16 ++++++---------- roles/zabbix_javagateway/tasks/main.yml | 16 ++++++---------- roles/zabbix_proxy/tasks/main.yml | 11 ++++++----- roles/zabbix_server/tasks/main.yml | 11 ++++++----- roles/zabbix_web/tasks/main.yml | 11 ++++++----- 11 files changed, 41 insertions(+), 35 deletions(-) create mode 100644 changelogs/fragments/1224-enable-version-check.yml diff --git a/changelogs/fragments/1224-enable-version-check.yml b/changelogs/fragments/1224-enable-version-check.yml new file mode 100644 index 000000000..bf4324147 --- /dev/null +++ b/changelogs/fragments/1224-enable-version-check.yml @@ -0,0 +1,2 @@ +minor_changes: + - Introduce flag `enable_version_check` to allow installations on non-supported platforms. diff --git a/docs/ZABBIX_AGENT_ROLE.md b/docs/ZABBIX_AGENT_ROLE.md index 5efe7c9c7..fe4a601b3 100644 --- a/docs/ZABBIX_AGENT_ROLE.md +++ b/docs/ZABBIX_AGENT_ROLE.md @@ -102,6 +102,7 @@ See the following list of supported Operating systems with the Zabbix releases: | Debian 11 bullseye | V | V | V | | Debian 10 buster | V | V | V | +You can bypass this matrix by setting `enable_version_check: false` # Getting started diff --git a/docs/ZABBIX_JAVAGATEWAY_ROLE.md b/docs/ZABBIX_JAVAGATEWAY_ROLE.md index c83e4279f..47092a6a0 100644 --- a/docs/ZABBIX_JAVAGATEWAY_ROLE.md +++ b/docs/ZABBIX_JAVAGATEWAY_ROLE.md @@ -46,6 +46,8 @@ See the following list of supported Operating systems with the Zabbix releases. | Debian 11 bullseye | V | V | V | | Debian 10 buster | V | V | V | +You can bypass this matrix by setting `enable_version_check: false` + # Role Variables ## Main variables diff --git a/docs/ZABBIX_PROXY_ROLE.md b/docs/ZABBIX_PROXY_ROLE.md index f4c9922be..ee558c8b7 100644 --- a/docs/ZABBIX_PROXY_ROLE.md +++ b/docs/ZABBIX_PROXY_ROLE.md @@ -89,6 +89,8 @@ See the following list of supported Operating systems with the Zabbix releases. | Debian 11 bullseye | V | V | V | | Debian 10 buster | V | V | V | +You can bypass this matrix by setting `enable_version_check: false` + # Role Variables ## Main variables diff --git a/docs/ZABBIX_SERVER_ROLE.md b/docs/ZABBIX_SERVER_ROLE.md index 9c3139480..9557281c3 100644 --- a/docs/ZABBIX_SERVER_ROLE.md +++ b/docs/ZABBIX_SERVER_ROLE.md @@ -86,6 +86,8 @@ See the following list of supported Operating systems with the Zabbix releases: | Debian 11 bullseye | V | V | V | | Debian 10 buster | | | V | +You can bypass this matrix by setting `enable_version_check: false` + # Installation Installing this role is very simple: `ansible-galaxy install community.zabbix.zabbix_server` diff --git a/docs/ZABBIX_WEB_ROLE.md b/docs/ZABBIX_WEB_ROLE.md index 91ef7e236..54ba25a5d 100644 --- a/docs/ZABBIX_WEB_ROLE.md +++ b/docs/ZABBIX_WEB_ROLE.md @@ -65,6 +65,8 @@ See the following list of supported Operating Systems with the Zabbix releases. | Debian 11 bullseye | V | V | V | | Debian 10 buster | | | V | +You can bypass this matrix by setting `enable_version_check: false` + # Installation Installing this role is very simple: `ansible-galaxy install community.zabbix.zabbix_web` diff --git a/roles/zabbix_agent/tasks/main.yml b/roles/zabbix_agent/tasks/main.yml index 3b692aef0..2b028c40e 100644 --- a/roles/zabbix_agent/tasks/main.yml +++ b/roles/zabbix_agent/tasks/main.yml @@ -12,16 +12,12 @@ tags: - always -- name: Set More Variables - ansible.builtin.set_fact: - zabbix_valid_version: "{{ zabbix_agent_version|float in zabbix_valid_agent_versions[ansible_distribution_major_version] }}" - tags: - - always - -- name: Stopping Install of Invalid Version - ansible.builtin.fail: - msg: Zabbix version {{ zabbix_agent_version }} is not supported on {{ ansible_distribution }} {{ ansible_distribution_major_version }} - when: not zabbix_valid_version +- name: Check that version is supported + when: enable_version_check | default(true) | bool + ansible.builtin.assert: + that: + - "{{ zabbix_agent_version|float in zabbix_valid_agent_versions[ansible_distribution_major_version] }}" + fail_msg: Zabbix version {{ zabbix_agent_version }} is not supported on {{ ansible_distribution }} {{ ansible_distribution_major_version }} tags: - always diff --git a/roles/zabbix_javagateway/tasks/main.yml b/roles/zabbix_javagateway/tasks/main.yml index 6b56d43d3..aeeecbc8f 100644 --- a/roles/zabbix_javagateway/tasks/main.yml +++ b/roles/zabbix_javagateway/tasks/main.yml @@ -13,16 +13,12 @@ tags: - always -- name: Set More Variables - ansible.builtin.set_fact: - zabbix_valid_version: "{{ zabbix_javagateway_version|float in zabbix_valid_javagateway_versions[ansible_distribution_major_version] }}" - tags: - - always - -- name: Stopping Install of Invalid Version - ansible.builtin.fail: - msg: Zabbix version {{ zabbix_javagateway_version }} is not supported on {{ ansible_distribution }} {{ ansible_distribution_major_version }} - when: not zabbix_valid_version +- name: Check that version is supported + when: enable_version_check | default(true) | bool + ansible.builtin.assert: + that: + - "{{ zabbix_javagateway_version|float in zabbix_valid_javagateway_versions[ansible_distribution_major_version] }}" + fail_msg: Zabbix version {{ zabbix_javagateway_version }} is not supported on {{ ansible_distribution }} {{ ansible_distribution_major_version }} tags: - always diff --git a/roles/zabbix_proxy/tasks/main.yml b/roles/zabbix_proxy/tasks/main.yml index f564635b1..1e8831c35 100644 --- a/roles/zabbix_proxy/tasks/main.yml +++ b/roles/zabbix_proxy/tasks/main.yml @@ -15,17 +15,18 @@ - name: Set More Variables ansible.builtin.set_fact: zabbix_proxy_db_long: "{{ 'postgresql' if zabbix_proxy_database == 'pgsql' else zabbix_proxy_database }}" - zabbix_valid_version: "{{ zabbix_proxy_version|float in zabbix_valid_proxy_versions[ansible_distribution_major_version] }}" zabbix_short_version: "{{ zabbix_proxy_version | regex_replace('\\.', '') }}" zabbix_proxy_fpinglocation: "{{ zabbix_proxy_fpinglocation if zabbix_proxy_fpinglocation is defined else _zabbix_proxy_fpinglocation}}" zabbix_proxy_fping6location: "{{ zabbix_proxy_fping6location if zabbix_proxy_fping6location is defined else _zabbix_proxy_fping6location}}" tags: - always -- name: Stopping Install of Invalid Version - ansible.builtin.fail: - msg: Zabbix version {{ zabbix_proxy_version }} is not supported on {{ ansible_distribution }} {{ ansible_distribution_major_version }} - when: not zabbix_valid_version +- name: Check that version is supported + when: enable_version_check | default(true) | bool + ansible.builtin.assert: + that: + - "{{ zabbix_proxy_version|float in zabbix_valid_proxy_versions[ ansible_facts['distribution_major_version'] ] }}" + fail_msg: Zabbix version {{ zabbix_proxy_version }} is not supported on {{ ansible_facts['distribution'] }} {{ ansible_facts['distribution_major_version'] }} tags: - always diff --git a/roles/zabbix_server/tasks/main.yml b/roles/zabbix_server/tasks/main.yml index 62674a7ff..cd47342e8 100644 --- a/roles/zabbix_server/tasks/main.yml +++ b/roles/zabbix_server/tasks/main.yml @@ -14,16 +14,17 @@ - name: Set More Variables ansible.builtin.set_fact: zabbix_db_type_long: "{{ 'postgresql' if zabbix_server_database == 'pgsql' else 'mysql' }}" - zabbix_valid_version: "{{ zabbix_server_version|float in zabbix_valid_server_versions[ansible_distribution_major_version] }}" zabbix_server_fpinglocation: "{{ zabbix_server_fpinglocation if zabbix_server_fpinglocation is defined else _zabbix_server_fpinglocation}}" zabbix_server_fping6location: "{{ zabbix_server_fping6location if zabbix_server_fping6location is defined else _zabbix_server_fping6location}}" tags: - always -- name: Stopping Install of Invalid Version - ansible.builtin.fail: - msg: Zabbix version {{ zabbix_server_version }} is not supported on {{ ansible_distribution }} {{ ansible_distribution_major_version }} - when: not zabbix_valid_version +- name: Check that version is supported + when: enable_version_check | default(true) | bool + ansible.builtin.assert: + that: + - "{{ zabbix_server_version|float in zabbix_valid_server_versions[ ansible_facts['distribution_major_version'] ] }}" + fail_msg: Zabbix version {{ zabbix_server_version }} is not supported on {{ ansible_facts['distribution'] }} {{ ansible_facts['distribution_major_version'] }} tags: - always diff --git a/roles/zabbix_web/tasks/main.yml b/roles/zabbix_web/tasks/main.yml index b82d8486b..54a313a1c 100644 --- a/roles/zabbix_web/tasks/main.yml +++ b/roles/zabbix_web/tasks/main.yml @@ -13,15 +13,16 @@ - name: Set More Variables ansible.builtin.set_fact: - zabbix_valid_version: "{{ zabbix_web_version|float in zabbix_valid_web_versions[ansible_distribution_major_version] }}" zabbix_db_type_long: "{{ 'postgresql' if zabbix_server_database == 'pgsql' else 'mysql' }}" tags: - always -- name: Stopping Install of Invalid Version - ansible.builtin.fail: - msg: Zabbix version {{ zabbix_web_version }} is not supported on {{ ansible_distribution }} {{ ansible_distribution_major_version }} - when: not zabbix_valid_version +- name: Check that version is supported + when: enable_version_check | default(true) | bool + ansible.builtin.assert: + that: + - "{{ zabbix_web_version|float in zabbix_valid_web_versions[ ansible_facts['distribution_major_version'] ] }}" + fail_msg: Zabbix version {{ zabbix_web_version }} is not supported on {{ ansible_facts['distribution'] }} {{ ansible_facts['distribution_major_version'] }} tags: - always