From bfe10c9d693741cf7da5cbc45e3031757c3d07d1 Mon Sep 17 00:00:00 2001 From: jon4hz Date: Sat, 8 Jun 2024 01:16:27 +0200 Subject: [PATCH] fix: install suse repo with zabbix_repo role --- .github/workflows/repo.yml | 1 + molecule/zabbix_repo/prepare.yml | 1 + roles/zabbix_agent/defaults/main.yml | 11 ----------- roles/zabbix_agent/tasks/Suse.yml | 15 --------------- roles/zabbix_javagateway/defaults/main.yml | 11 ----------- roles/zabbix_javagateway/tasks/Suse.yml | 15 --------------- roles/zabbix_proxy/defaults/main.yml | 11 ----------- roles/zabbix_proxy/tasks/Suse.yml | 15 --------------- roles/zabbix_repo/defaults/main.yml | 11 +++++++++++ roles/zabbix_repo/tasks/Suse.yml | 17 +++++++++++++++++ roles/zabbix_repo/vars/Suse.yml | 1 + roles/zabbix_server/defaults/main.yml | 11 ----------- roles/zabbix_server/tasks/Suse.yml | 15 --------------- roles/zabbix_web/defaults/main.yml | 11 ----------- roles/zabbix_web/handlers/main.yml | 2 -- roles/zabbix_web/tasks/Suse.yml | 15 --------------- 16 files changed, 31 insertions(+), 132 deletions(-) create mode 100644 roles/zabbix_repo/tasks/Suse.yml create mode 100644 roles/zabbix_repo/vars/Suse.yml diff --git a/.github/workflows/repo.yml b/.github/workflows/repo.yml index bedd2d835..184794221 100644 --- a/.github/workflows/repo.yml +++ b/.github/workflows/repo.yml @@ -27,6 +27,7 @@ jobs: - ubuntu2004 - debian12 - debian11 + - opensuseleap15 collection_role: - zabbix_repo version: diff --git a/molecule/zabbix_repo/prepare.yml b/molecule/zabbix_repo/prepare.yml index 1d33fac42..293240581 100644 --- a/molecule/zabbix_repo/prepare.yml +++ b/molecule/zabbix_repo/prepare.yml @@ -10,6 +10,7 @@ until: installation_dependencies is succeeded when: - ansible_os_family != 'RedHat' + - ansible_os_family != 'Suse' - name: "Configure SUDO." ansible.builtin.lineinfile: diff --git a/roles/zabbix_agent/defaults/main.yml b/roles/zabbix_agent/defaults/main.yml index cb2642c55..8831cc759 100644 --- a/roles/zabbix_agent/defaults/main.yml +++ b/roles/zabbix_agent/defaults/main.yml @@ -28,17 +28,6 @@ zabbix_apt_install_recommends: false zabbix_agent_disable_repo: - epel -zabbix_repo_zypper_auto_import_keys: true -zabbix_repo_zypper_disable_gpg_check: false -zabbix_repo_zypper_schema: https -zabbix_repo_zypper: - - name: zabbix - description: Zabbix Official Repository - repo: "{{ zabbix_repo_zypper_schema }}://repo.zabbix.com/zabbix/{{ zabbix_agent_version }}/sles/{{ zabbix_agent_distribution_major_version }}/$basearch/" - disable_gpg_check: "{{ zabbix_repo_zypper_disable_gpg_check }}" - auto_import_keys: "{{ zabbix_repo_zypper_auto_import_keys }}" - state: present - # Zabbix API stuff zabbix_api_server_host: localhost zabbix_api_login_user: Admin diff --git a/roles/zabbix_agent/tasks/Suse.yml b/roles/zabbix_agent/tasks/Suse.yml index caed19f96..49f909b31 100644 --- a/roles/zabbix_agent/tasks/Suse.yml +++ b/roles/zabbix_agent/tasks/Suse.yml @@ -1,21 +1,6 @@ --- # Tasks specific for SUSE systems -- name: "Suse | Install repos" - community.general.zypper_repository: - name: "{{ item.name }}" - description: "{{ item.description }}" - repo: "{{ item.repo }}" - disable_gpg_check: "{{ item.disable_gpg_check | default(false) }}" - auto_import_keys: "{{ item.auto_import_keys | default('true') }}" - priority: "{{ item.priority | default('99') }}" - runrefresh: "{{ item.runrefresh | default(false) }}" - state: "{{ item.state | default('present') }}" - with_items: "{{ zabbix_repo_zypper }}" - become: true - tags: - - install - - name: Check if warn parameter can be used for shell module ansible.builtin.set_fact: produce_warn: false diff --git a/roles/zabbix_javagateway/defaults/main.yml b/roles/zabbix_javagateway/defaults/main.yml index 915067ff3..a06311ae0 100644 --- a/roles/zabbix_javagateway/defaults/main.yml +++ b/roles/zabbix_javagateway/defaults/main.yml @@ -8,17 +8,6 @@ zabbix_java_gateway_conf_mode: "0644" zabbix_javagateway_disable_repo: - epel -zabbix_repo_zypper_auto_import_keys: true -zabbix_repo_zypper_disable_gpg_check: false -zabbix_repo_zypper_schema: https -zabbix_repo_zypper: - - name: zabbix - description: Zabbix Official Repository - repo: "{{ zabbix_repo_zypper_schema }}://repo.zabbix.com/zabbix/{{ zabbix_javagateway_version }}/sles/{{ ansible_distribution_major_version }}/$basearch/" - disable_gpg_check: "{{ zabbix_repo_zypper_disable_gpg_check }}" - auto_import_keys: "{{ zabbix_repo_zypper_auto_import_keys }}" - state: present - zabbix_javagateway_openjdk_version: 17 zabbix_javagateway_pidfile: /run/zabbix/zabbix_java_gateway.pid diff --git a/roles/zabbix_javagateway/tasks/Suse.yml b/roles/zabbix_javagateway/tasks/Suse.yml index c9e206d17..b8dc67680 100644 --- a/roles/zabbix_javagateway/tasks/Suse.yml +++ b/roles/zabbix_javagateway/tasks/Suse.yml @@ -1,21 +1,6 @@ --- # Tasks specific for Suse systems -- name: "Suse | Install repos" - community.general.zypper_repository: - name: "{{ item.name }}" - description: "{{ item.description }}" - repo: "{{ item.repo }}" - disable_gpg_check: "{{ item.disable_gpg_check | default(false) }}" - auto_import_keys: "{{ item.auto_import_keys | default('true') }}" - priority: "{{ item.priority | default('99') }}" - runrefresh: "{{ item.runrefresh | default(false) }}" - state: "{{ item.state | default('present') }}" - with_items: "{{ zabbix_repo_zypper }}" - become: true - tags: - - install - # SLES 15 comes with openjdk-11 by default. # In order for the zabbix-java-gateway to work, we need to install openjdk-17. - name: "Suse | Install openjdk-{{ zabbix_javagateway_openjdk_version }}" diff --git a/roles/zabbix_proxy/defaults/main.yml b/roles/zabbix_proxy/defaults/main.yml index e4257bcb2..80574b9d6 100644 --- a/roles/zabbix_proxy/defaults/main.yml +++ b/roles/zabbix_proxy/defaults/main.yml @@ -41,17 +41,6 @@ zabbix_proxy_version_minor: "*" # Yum/APT Variables zabbix_proxy_package_state: present -zabbix_repo_zypper_auto_import_keys: true -zabbix_repo_zypper_disable_gpg_check: false -zabbix_repo_zypper_schema: https -zabbix_repo_zypper: - - name: zabbix - description: Zabbix Official Repository - repo: "{{ zabbix_repo_zypper_schema }}://repo.zabbix.com/zabbix/{{ zabbix_proxy_version | regex_search('^[0-9]+.[0-9]+') }}/sles/{{ ansible_distribution_major_version }}/$basearch/" - disable_gpg_check: "{{ zabbix_repo_zypper_disable_gpg_check }}" - auto_import_keys: "{{ zabbix_repo_zypper_auto_import_keys }}" - state: present - # Proxy Configuration Variables (Only ones with role provided defaults) zabbix_proxy_allowroot: 0 zabbix_proxy_allowunsupporteddbversions: 0 diff --git a/roles/zabbix_proxy/tasks/Suse.yml b/roles/zabbix_proxy/tasks/Suse.yml index db9dbd36e..527658db7 100644 --- a/roles/zabbix_proxy/tasks/Suse.yml +++ b/roles/zabbix_proxy/tasks/Suse.yml @@ -15,21 +15,6 @@ tags: - always -- name: "Suse | Install repos" - community.general.zypper_repository: - name: "{{ item.name }}" - description: "{{ item.description }}" - repo: "{{ item.repo }}" - disable_gpg_check: "{{ item.disable_gpg_check | default(false) }}" - auto_import_keys: "{{ item.auto_import_keys | default('true') }}" - priority: "{{ item.priority | default('99') }}" - runrefresh: "{{ item.runrefresh | default(false) }}" - state: "{{ item.state | default('present') }}" - with_items: "{{ zabbix_repo_zypper }}" - become: true - tags: - - install - - name: Install packages for Zabbix Repository tags: - install diff --git a/roles/zabbix_repo/defaults/main.yml b/roles/zabbix_repo/defaults/main.yml index 4e22f7d59..69a8a1df8 100644 --- a/roles/zabbix_repo/defaults/main.yml +++ b/roles/zabbix_repo/defaults/main.yml @@ -24,3 +24,14 @@ zabbix_repo_apt_priority: zabbix_repo_deb_gpg_key_url: http://repo.zabbix.com/zabbix-official-repo.key zabbix_repo_deb_include_deb_src: true zabbix_repo_rpm_gpg_key_url: http://repo.zabbix.com/RPM-GPG-KEY-ZABBIX-08EFA7DD + +zabbix_repo_zypper_auto_import_keys: true +zabbix_repo_zypper_disable_gpg_check: false +zabbix_repo_zypper_schema: https +zabbix_repo_zypper: + - name: zabbix + description: Zabbix Official Repository + repo: "{{ zabbix_repo_zypper_schema }}://repo.zabbix.com/zabbix/{{ zabbix_repo_version | regex_search('^[0-9]+.[0-9]+') }}/sles/{{ ansible_distribution_major_version }}/$basearch/" + disable_gpg_check: "{{ zabbix_repo_zypper_disable_gpg_check }}" + auto_import_keys: "{{ zabbix_repo_zypper_auto_import_keys }}" + state: present diff --git a/roles/zabbix_repo/tasks/Suse.yml b/roles/zabbix_repo/tasks/Suse.yml new file mode 100644 index 000000000..9b93dbc1f --- /dev/null +++ b/roles/zabbix_repo/tasks/Suse.yml @@ -0,0 +1,17 @@ +--- +# Tasks specific for Suse systems + +- name: "Suse | Install repos" + community.general.zypper_repository: + name: "{{ item.name }}" + description: "{{ item.description }}" + repo: "{{ item.repo }}" + disable_gpg_check: "{{ item.disable_gpg_check | default(false) }}" + auto_import_keys: "{{ item.auto_import_keys | default('true') }}" + priority: "{{ item.priority | default('99') }}" + runrefresh: "{{ item.runrefresh | default(false) }}" + state: "{{ item.state | default('present') }}" + with_items: "{{ zabbix_repo_zypper }}" + become: true + tags: + - install diff --git a/roles/zabbix_repo/vars/Suse.yml b/roles/zabbix_repo/vars/Suse.yml new file mode 100644 index 000000000..ed97d539c --- /dev/null +++ b/roles/zabbix_repo/vars/Suse.yml @@ -0,0 +1 @@ +--- diff --git a/roles/zabbix_server/defaults/main.yml b/roles/zabbix_server/defaults/main.yml index bd1c95409..fbd103d75 100644 --- a/roles/zabbix_server/defaults/main.yml +++ b/roles/zabbix_server/defaults/main.yml @@ -42,17 +42,6 @@ zabbix_server_version_minor: "*" zabbix_server_package_state: present zabbix_server_conf_mode: 0640 -zabbix_repo_zypper_auto_import_keys: true -zabbix_repo_zypper_disable_gpg_check: false -zabbix_repo_zypper_schema: https -zabbix_repo_zypper: - - name: zabbix - description: Zabbix Official Repository - repo: "{{ zabbix_repo_zypper_schema }}://repo.zabbix.com/zabbix/{{ zabbix_server_version | regex_search('^[0-9]+.[0-9]+') }}/sles/{{ ansible_distribution_major_version }}/$basearch/" - disable_gpg_check: "{{ zabbix_repo_zypper_disable_gpg_check }}" - auto_import_keys: "{{ zabbix_repo_zypper_auto_import_keys }}" - state: present - # Server Configuration Variables (Only ones with role provided defaults) zabbix_server_alertscriptspath: /usr/lib/zabbix/alertscripts zabbix_server_allowroot: 0 diff --git a/roles/zabbix_server/tasks/Suse.yml b/roles/zabbix_server/tasks/Suse.yml index 439d3cb54..38a1d98f8 100644 --- a/roles/zabbix_server/tasks/Suse.yml +++ b/roles/zabbix_server/tasks/Suse.yml @@ -20,21 +20,6 @@ tags: - always -- name: "Suse | Install repos" - community.general.zypper_repository: - name: "{{ item.name }}" - description: "{{ item.description }}" - repo: "{{ item.repo }}" - disable_gpg_check: "{{ item.disable_gpg_check | default(false) }}" - auto_import_keys: "{{ item.auto_import_keys | default('true') }}" - priority: "{{ item.priority | default('99') }}" - runrefresh: "{{ item.runrefresh | default(false) }}" - state: "{{ item.state | default('present') }}" - with_items: "{{ zabbix_repo_zypper }}" - become: true - tags: - - install - - name: "Suse | Installing zabbix-server-{{ zabbix_server_database }}" ansible.builtin.package: pkg: "{{ zabbix_server_package }}" diff --git a/roles/zabbix_web/defaults/main.yml b/roles/zabbix_web/defaults/main.yml index e26c35fc6..e5833485a 100644 --- a/roles/zabbix_web/defaults/main.yml +++ b/roles/zabbix_web/defaults/main.yml @@ -53,17 +53,6 @@ zabbix_web_version_minor: "*" zabbix_web_disable_repo: - epel -zabbix_repo_zypper_auto_import_keys: true -zabbix_repo_zypper_disable_gpg_check: false -zabbix_repo_zypper_schema: https -zabbix_repo_zypper: - - name: zabbix - description: Zabbix Official Repository - repo: "{{ zabbix_repo_zypper_schema }}://repo.zabbix.com/zabbix/{{ zabbix_web_version | regex_search('^[0-9]+.[0-9]+') }}/sles/{{ ansible_distribution_major_version }}/$basearch/" - disable_gpg_check: "{{ zabbix_repo_zypper_disable_gpg_check }}" - auto_import_keys: "{{ zabbix_repo_zypper_auto_import_keys }}" - state: present - # Elasticsearch # zabbix_server_history_url: # - "'uint' => 'http://localhost:9200'" diff --git a/roles/zabbix_web/handlers/main.yml b/roles/zabbix_web/handlers/main.yml index 9086ca546..53dd6d0e1 100644 --- a/roles/zabbix_web/handlers/main.yml +++ b/roles/zabbix_web/handlers/main.yml @@ -35,7 +35,6 @@ become: true when: - ansible_os_family == 'Debian' - - zabbix_web_version is version('5.0', '>=') - name: restart php-fpm ansible.builtin.service: @@ -45,7 +44,6 @@ become: true when: - ansible_os_family == 'Suse' - - zabbix_web_version is version('5.0', '>=') - name: "clean repo files from proxy creds" ansible.builtin.shell: ls /etc/yum.repos.d/zabbix* && sed -i 's/^proxy =.*//' /etc/yum.repos.d/zabbix* || true diff --git a/roles/zabbix_web/tasks/Suse.yml b/roles/zabbix_web/tasks/Suse.yml index 6f61bfd5d..77b77f94b 100644 --- a/roles/zabbix_web/tasks/Suse.yml +++ b/roles/zabbix_web/tasks/Suse.yml @@ -5,21 +5,6 @@ tags: - always -- name: "Suse | Install repos" - community.general.zypper_repository: - name: "{{ item.name }}" - description: "{{ item.description }}" - repo: "{{ item.repo }}" - disable_gpg_check: "{{ item.disable_gpg_check | default(false) }}" - auto_import_keys: "{{ item.auto_import_keys | default('true') }}" - priority: "{{ item.priority | default('99') }}" - runrefresh: "{{ item.runrefresh | default(false) }}" - state: "{{ item.state | default('present') }}" - with_items: "{{ zabbix_repo_zypper }}" - become: true - tags: - - install - - name: "Suse | Install zabbix-web-{{ zabbix_server_database }}" ansible.builtin.package: pkg: