From 23f2acbd5a176e69c0084fac8a609c2f7cd7323c Mon Sep 17 00:00:00 2001 From: jon4hz Date: Sun, 24 Mar 2024 20:57:49 +0100 Subject: [PATCH] feat: zabbix-web installation on suse --- .github/workflows/web.yml | 2 ++ molecule/zabbix_web/prepare.yml | 16 ++++++++++++++ roles/zabbix_web/defaults/main.yml | 11 ++++++++++ roles/zabbix_web/tasks/Suse.yml | 35 ++++++++++++++++++++++++++++++ roles/zabbix_web/vars/Suse.yml | 23 ++++++++++++++++++++ 5 files changed, 87 insertions(+) create mode 100644 roles/zabbix_web/tasks/Suse.yml create mode 100644 roles/zabbix_web/vars/Suse.yml diff --git a/.github/workflows/web.yml b/.github/workflows/web.yml index b96deb308..e64156b00 100644 --- a/.github/workflows/web.yml +++ b/.github/workflows/web.yml @@ -28,12 +28,14 @@ jobs: - debian12 - debian11 - debian10 + # - opensuseleap15 collection_role: - zabbix_web database: - mysql - pgsql web_server: + # maybe add apache? - nginx version: - v64 diff --git a/molecule/zabbix_web/prepare.yml b/molecule/zabbix_web/prepare.yml index 204eb8f56..935799eb4 100644 --- a/molecule/zabbix_web/prepare.yml +++ b/molecule/zabbix_web/prepare.yml @@ -90,6 +90,7 @@ until: installation_dependencies is succeeded when: - ansible_os_family != 'RedHat' + - ansible_os_family != 'Suse' - name: "Installing packages on NON-CentOS" ansible.builtin.apt: @@ -106,6 +107,21 @@ until: installation_dependencies is succeeded when: - ansible_os_family != 'RedHat' + - ansible_os_family != 'Suse' + + - name: "Installing packages on Suse" + community.general.zypper: + name: + - iproute2 + - python3-pip + - sudo + - curl + update_cache: true + state: present + register: installation_dependencies + until: installation_dependencies is succeeded + when: + - ansible_os_family == 'Suse' - name: "Configure SUDO." ansible.builtin.lineinfile: diff --git a/roles/zabbix_web/defaults/main.yml b/roles/zabbix_web/defaults/main.yml index c9a3d51df..cbeb7ce1f 100644 --- a/roles/zabbix_web/defaults/main.yml +++ b/roles/zabbix_web/defaults/main.yml @@ -72,6 +72,17 @@ zabbix_repo_yum: gpgkey: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX 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_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/tasks/Suse.yml b/roles/zabbix_web/tasks/Suse.yml new file mode 100644 index 000000000..6f61bfd5d --- /dev/null +++ b/roles/zabbix_web/tasks/Suse.yml @@ -0,0 +1,35 @@ +--- +- name: "Suse | Setting Short PHP Version" + ansible.builtin.set_fact: + zabbix_web_php_installed_version: "{{ zabbix_web_php_installed_version | regex_replace('\\.', '') }}" + 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: + - "zabbix-web-{{ zabbix_server_database }}" + state: "{{ zabbix_web_package_state }}" + environment: + http_proxy: "{{ zabbix_http_proxy | default(None) | default(omit) }}" + https_proxy: "{{ zabbix_https_proxy | default(None) | default(omit) }}" + register: zabbix_web_package_install + until: zabbix_web_package_install is succeeded + become: true + tags: + - install diff --git a/roles/zabbix_web/vars/Suse.yml b/roles/zabbix_web/vars/Suse.yml new file mode 100644 index 000000000..f168fdee0 --- /dev/null +++ b/roles/zabbix_web/vars/Suse.yml @@ -0,0 +1,23 @@ +--- +_apache_user: wwwrun +_apache_group: wwwrun +_apache_log: apache2 +_apache_service: apache2 +_apache_vhost_location: /etc/apache2/conf.d/zabbix.conf + +_php_fpm_dir: /etc/php-fpm.d +_php_fpm_session: /var/lib/php/session +_zabbix_php_fpm_listen: /run/php-fpm/zabbix.sock + +_nginx_user: nginx +_nginx_group: nginx +_nginx_vhost_location: /etc/nginx/conf.d/zabbix.conf +_nginx_log_path: /var/log/nginx +_nginx_service: nginx + + +zabbix_valid_web_versions: + "15": + - 6.4 + - 6.2 + - 6.0