Skip to content

Commit

Permalink
Feature/suse support (#273)
Browse files Browse the repository at this point in the history
* Added suse support for following roles:
  - icinga2
  - repos
  - icingaweb2
  - icingadb
  - icingadb_redis

* add general information about zypper requirements

* add suse/sles to os matrix
  • Loading branch information
mkayontour authored Mar 22, 2024
1 parent 9dc0e5d commit 8c3bf84
Show file tree
Hide file tree
Showing 16 changed files with 93 additions and 3 deletions.
10 changes: 10 additions & 0 deletions doc/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,16 @@ collection. All features which are not configured will be disabled.

---

## Requirements

**Operatingsystems**:
For **OSFamily Suse** please make sure the Collection **community.general** is available.
Otherwise the modules **zypper_repository** and **zypper** are missing.

**Imports**:
If you want the collection roles to **import schemas and users to databases**, make sure
the client (**"mysql", "psql"**) for your database is available on your system.

## Installation

To start with the collection, easily install it with the **ansible-galaxy** command.
Expand Down
6 changes: 6 additions & 0 deletions roles/icinga2/meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ galaxy_info:
license: Apache-2.0
min_ansible_version: 2.9
platforms:
- name: opensuse
versions:
- 15.5
- name: SLES
versions:
- 15
- name: EL
versions:
- 7
Expand Down
4 changes: 4 additions & 0 deletions roles/icinga2/tasks/features/idomysql/install_on_Suse.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- name: Zypper - install package icinga2-ido-mysql
community.general.zypper:
name: icinga2-ido-mysql
state: present
4 changes: 4 additions & 0 deletions roles/icinga2/tasks/features/idopgsql/install_on_Suse.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- name: Zypper - install package icinga2-ido-pgsql
community.general.zypper:
name: icinga2-ido-pgsql
state: present
4 changes: 4 additions & 0 deletions roles/icingadb/meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ galaxy_info:
license: Apache-2.0
min_ansible_version: 2.9
platforms:
- name: opensuse
versions: ['15.5']
- name: SLES
versions: ['15']
- name: EL
versions: ['7']
- name: Debian
Expand Down
4 changes: 4 additions & 0 deletions roles/icingadb/tasks/install_on_suse.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- name: Suse - Install IcingaDB packages
community.general.zypper:
name: "{{ icingadb_packages }}"
state: present
4 changes: 4 additions & 0 deletions roles/icingadb_redis/meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ galaxy_info:
license: Apache-2.0
min_ansible_version: 2.9
platforms:
- name: opensuse
versions: ['15.5']
- name: SLES
versions: ['15']
- name: EL
versions: ['7']
- name: Debian
Expand Down
5 changes: 5 additions & 0 deletions roles/icingadb_redis/tasks/install_on_suse.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
- name: Suse - install icingadb packages
community.general.zypper:
name: "{{ icingadb_redis_packages }}"
state: present
4 changes: 4 additions & 0 deletions roles/icingaweb2/meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ galaxy_info:
license: Apache-2.0
min_ansible_version: 2.9
platforms:
- name: opensuse
versions: ['15.5']
- name: SLES
versions: ['15']
- name: EL
versions: ['7','8']
- name: Debian
Expand Down
5 changes: 5 additions & 0 deletions roles/icingaweb2/tasks/install_on_suse.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
- name: Suse - Install Icinga Web 2 packages
community.general.zypper:
name: "{{ icingaweb2_packages }}"
state: present
4 changes: 2 additions & 2 deletions roles/icingaweb2/tasks/manage_icingaweb_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
when: icingaweb2_resources is defined

- name: Assemble roles.ini
when: icingaweb2_admin_password is defined or icingaweb2_roles is defined
when: icingaweb2_admin_username is defined and icingaweb2_admin_password is defined
block:
- name: Build variable
ansible.builtin.set_fact:
Expand All @@ -108,7 +108,7 @@
dest: "{{ icingaweb2_fragments_path }}/roles/roles_01"
owner: root
group: "{{ icingaweb2_group }}"
when: icingaweb2_admin_password is defined
when: icingaweb2_admin_username is defined and icingaweb2_admin_password is defined

- name: Build variable
ansible.builtin.set_fact:
Expand Down
4 changes: 4 additions & 0 deletions roles/icingaweb2/vars/suse.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
icingaweb2_httpd_user: wwwrun
icingaweb2_fragments_path: /var/tmp/icingaweb
icingaweb2_packages: ["icingaweb2", "icingacli"]
5 changes: 5 additions & 0 deletions roles/repos/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ icinga_repo_yum_snapshot_url: "http://packages.icinga.com/epel/$releasever/snaps
icinga_repo_yum_snapshot_key: "{{ icinga_repo_gpgkey }}"
icinga_repo_yum_snapshot_description: "ICINGA (snapshot release for epel)"

icinga_repo_zypper_key: "{{ icinga_repo_gpgkey }}"
icinga_repo_zypper_stable_url: "https://packages.icinga.com/openSUSE/$releasever/release/"
#icinga_repo_zypper_testing_url: ""
icinga_repo_zypper_snapshot_url: "https://packages.icinga.com/openSUSE/$releasever/snapshot/"

icinga_repo_apt_key: "{{ icinga_repo_gpgkey }}"
icinga_repo_apt_keyring: /etc/apt/keyrings/icinga-archive-keyring.asc
icinga_repo_apt_stable_deb: "deb [signed-by={{ icinga_repo_apt_keyring }}] http://packages.icinga.com/{{ ansible_distribution|lower }} icinga-{{ ansible_distribution_release|lower }} main"
Expand Down
6 changes: 6 additions & 0 deletions roles/repos/meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ galaxy_info:
license: AGPL-3.0-only
min_ansible_version: 2.9
platforms:
- name: opensuse
versions:
- 15.5
- name: SLES
versions:
- 15
- name: EL
versions:
- 7
Expand Down
2 changes: 1 addition & 1 deletion roles/repos/tasks/Debian.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
- name: Apt - ensure apt keyrings directory
file:
ansible.builtin.file:
state: directory
path: /etc/apt/keyrings
owner: root
Expand Down
25 changes: 25 additions & 0 deletions roles/repos/tasks/Suse.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---

- name: Suse - add RPM key
ansible.builtin.rpm_key:
state: present
key: "{{ icinga_repo_zypper_key }}"

- name: Suse - add Icinga repository (stable)
community.general.zypper_repository:
name: icinga-stable-release
description: ICINGA (stable release for openSUSE)
state: "{{ 'present' if icinga_repo_stable|bool else 'absent' }}"
repo: "{{ icinga_repo_zypper_stable_url }}"

- name: Suse - add Icinga repository (testing)
ansible.builtin.fail:
msg: "Suse Testing repo is not available."
when: icinga_repo_testing|bool == true

- name: Suse - add Icinga repository (snapshot)
community.general.zypper_repository:
name: icinga-snapshot-builds
description: ICINGA (snapshot builds for openSUSE)
repo: "{{ icinga_repo_zypper_snapshot_url }}"
state: "{{ 'present' if icinga_repo_snapshot|bool else 'absent' }}"

0 comments on commit 8c3bf84

Please sign in to comment.