Skip to content

Commit

Permalink
feat: add support for suse
Browse files Browse the repository at this point in the history
feat: zabbix-java-gateway installation on suse

feat: zabbix-proxy installation on suse

feat: zabbix-server installation on suse

fix: remove mysql stuff

fix: zabbix-server v6.2 is not working

feat: zabbix-web installation on suse

fix: zabbix-web php configuration

fix: rebasing issues
  • Loading branch information
jon4hz committed Jun 7, 2024
1 parent 321e642 commit 1e33806
Show file tree
Hide file tree
Showing 31 changed files with 609 additions and 7 deletions.
1 change: 1 addition & 0 deletions .github/workflows/agent.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ jobs:
- ubuntu2004
- debian12
- debian11
- opensuseleap15
version:
- v70
- v64
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/javagateway.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ jobs:
- ubuntu2004
- debian12
- debian11
- opensuseleap15
version:
- v70
- v64
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/proxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ jobs:
- ubuntu2004
- debian12
- debian11
- opensuseleap15
collection_role:
- zabbix_proxy
database:
Expand All @@ -43,6 +44,9 @@ jobs:
- v70
- v64
- v60
exclude:
- container: opensuseleap15
database: mysql

steps:
- name: Check out code
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ jobs:
- ubuntu2004
- debian12
- debian11
- opensuseleap15
collection_role:
- zabbix_server
database:
Expand All @@ -47,6 +48,8 @@ jobs:
version: v70
- container: debian11
version: v70
- container: opensuseleap15
database: mysql
steps:
- name: Check out code
uses: actions/checkout@v4
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,14 @@ jobs:
- ubuntu2004
- debian12
- debian11
# - opensuseleap15
collection_role:
- zabbix_web
database:
- mysql
- pgsql
web_server:
# maybe add apache?
- nginx
- apache
version:
Expand Down
12 changes: 10 additions & 2 deletions molecule/zabbix_agent_tests/common/playbooks/prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,18 @@
- ansible_os_family == 'Debian'

- name: "Installing packages on Suse family"
ansible.builtin.shell: zypper install -y python-xml python-libxml2 net-tools which
community.general.zypper:
name:
- python3-xml
- python3-libxml2
- net-tools
- iproute2
- which
state: present
register: zabbix_agent_prepare_packages_install
until: zabbix_agent_prepare_packages_install is succeeded
when: ansible_os_family == 'Suse'
when:
- ansible_os_family == 'Suse'
tags:
- skip_ansible_lint

Expand Down
14 changes: 14 additions & 0 deletions molecule/zabbix_javagateway/prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
regexp: "path-exclude=/usr/share/doc/*"
when:
- ansible_os_family != 'RedHat'
- ansible_os_family != 'Suse'

# https://github.com/geerlingguy/ansible-role-java/issues/64
- name: "Apt update"
Expand All @@ -29,6 +30,7 @@
until: installation_dependencies is succeeded
when:
- ansible_os_family != 'RedHat'
- ansible_os_family != 'Suse'

- name: "Installing packages on NON-CentOS"
ansible.builtin.apt:
Expand All @@ -47,3 +49,15 @@
until: installation_dependencies is succeeded
when:
- ansible_os_family != 'RedHat'
- ansible_os_family != 'Suse'

- name: "Installing packages on Suse"
community.general.zypper:
name:
- iproute2
- which
state: present
register: installation_dependencies
until: installation_dependencies is succeeded
when:
- ansible_os_family == 'Suse'
15 changes: 15 additions & 0 deletions molecule/zabbix_proxy/prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
until: installation_dependencies is succeeded
when:
- ansible_os_family != 'RedHat'
- ansible_os_family != 'Suse'

- name: "Installing packages on NON-CentOS"
ansible.builtin.apt:
Expand All @@ -78,6 +79,20 @@
until: installation_dependencies is succeeded
when:
- ansible_os_family != 'RedHat'
- ansible_os_family != 'Suse'

- name: "Installing packages on Suse"
community.general.zypper:
name:
- iproute2
- "{{ zabbix_python_prefix }}-pip"
- sudo
update_cache: true
state: present
register: installation_dependencies
until: installation_dependencies is succeeded
when:
- ansible_os_family == 'Suse'

- name: "Configure SUDO."
ansible.builtin.lineinfile:
Expand Down
14 changes: 14 additions & 0 deletions molecule/zabbix_server/prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
until: installation_dependencies is succeeded
when:
- ansible_os_family != 'RedHat'
- ansible_os_family != 'Suse'

- name: "Installing packages on NON-CentOS"
ansible.builtin.apt:
Expand All @@ -88,6 +89,19 @@
until: installation_dependencies is succeeded
when:
- ansible_os_family != 'RedHat'
- ansible_os_family != 'Suse'

- name: "Installing packages on Suse"
community.general.zypper:
name:
- iproute2
- sudo
state: present
update_cache: true
register: installation_dependencies
until: installation_dependencies is succeeded
when:
- ansible_os_family == 'Suse'

- name: "Configure SUDO."
ansible.builtin.lineinfile:
Expand Down
28 changes: 28 additions & 0 deletions molecule/zabbix_web/prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
until: installation_dependencies is succeeded
when:
- ansible_os_family != 'RedHat'
- ansible_os_family != 'Suse'

- name: "Installing packages on NON-CentOS"
ansible.builtin.apt:
Expand All @@ -89,6 +90,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:
Expand Down Expand Up @@ -186,6 +202,12 @@
- ansible_distribution_major_version >= '22'
- ansible_os_family == "Debian"

- name: Set PHP Version (Suse)
ansible.builtin.set_fact:
__php_default_version_suse: "8"
when:
- ansible_os_family == "Suse"

roles:
- role: geerlingguy.apache
when:
Expand All @@ -197,6 +219,12 @@
- role: zabbix_server

post_tasks:
- name: Suse | Create default php-fpm config
ansible.builtin.copy:
remote_src: true
src: "/etc/php8/fpm/php-fpm.conf.default"
dest: "/etc/php8/fpm/php-fpm.conf"

- name: "Remove file"
ansible.builtin.file:
path: "{{ item }}"
Expand Down
11 changes: 11 additions & 0 deletions roles/zabbix_agent/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,17 @@ 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
Expand Down
64 changes: 64 additions & 0 deletions roles/zabbix_agent/tasks/Suse.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
---
# 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
when: ansible_version.full is version("2.14", "<")
tags:
- always

- name: "Suse | Installing zabbix-agent"
ansible.builtin.package:
pkg:
- "{{ zabbix_agent_package }}"
state: "{{ zabbix_agent_package_state }}"
environment:
http_proxy: "{{ zabbix_http_proxy | default(None) | default(omit) }}"
https_proxy: "{{ zabbix_https_proxy | default(None) | default(omit) }}"
register: zabbix_agent_package_installed
until: zabbix_agent_package_installed is succeeded
become: true
tags:
- install

- name: "Suse | Installing zabbix-{sender,get}"
ansible.builtin.package:
pkg:
- "{{ zabbix_sender_package }}"
- "{{ zabbix_get_package }}"
state: "{{ zabbix_agent_package_state }}"
environment:
http_proxy: "{{ zabbix_http_proxy | default(None) | default(omit) }}"
https_proxy: "{{ zabbix_https_proxy | default(None) | default(omit) }}"
register: zabbix_agent_package_installed
until: zabbix_agent_package_installed is succeeded
when:
- not zabbix_agent_install_agent_only
become: true
tags:
- install

- name: "Suse | Enable the service"
ansible.builtin.service:
name: "{{ zabbix_agent_service }}"
enabled: true
use: service
become: true
tags:
- service
18 changes: 18 additions & 0 deletions roles/zabbix_agent/vars/Suse.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
# vars file for zabbix_agent (SLES)

zabbix_agent: zabbix-agent
zabbix_agent_service: zabbix-agent
zabbix_agent_conf: zabbix_agentd.conf
zabbix_agent2_conf: zabbix_agent2.conf

zabbix_valid_agent_versions:
# SLES
"12":
- 7.0
- 6.4
- 6.0
"15":
- 7.0
- 6.4
- 6.0
13 changes: 13 additions & 0 deletions roles/zabbix_javagateway/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,19 @@ 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
zabbix_javagateway_listenip: 0.0.0.0
zabbix_javagateway_listenport: 10052
Expand Down
Loading

0 comments on commit 1e33806

Please sign in to comment.