diff --git a/doc/getting-started.md b/doc/getting-started.md index b843a60f..1ec13cb5 100644 --- a/doc/getting-started.md +++ b/doc/getting-started.md @@ -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. diff --git a/roles/icinga2/meta/main.yml b/roles/icinga2/meta/main.yml index 48b76926..6eb45fa0 100644 --- a/roles/icinga2/meta/main.yml +++ b/roles/icinga2/meta/main.yml @@ -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 diff --git a/roles/icinga2/tasks/features/idomysql/install_on_Suse.yml b/roles/icinga2/tasks/features/idomysql/install_on_Suse.yml new file mode 100644 index 00000000..356ec5b1 --- /dev/null +++ b/roles/icinga2/tasks/features/idomysql/install_on_Suse.yml @@ -0,0 +1,4 @@ +- name: Zypper - install package icinga2-ido-mysql + community.general.zypper: + name: icinga2-ido-mysql + state: present diff --git a/roles/icinga2/tasks/features/idopgsql/install_on_Suse.yml b/roles/icinga2/tasks/features/idopgsql/install_on_Suse.yml new file mode 100644 index 00000000..79b3582a --- /dev/null +++ b/roles/icinga2/tasks/features/idopgsql/install_on_Suse.yml @@ -0,0 +1,4 @@ +- name: Zypper - install package icinga2-ido-pgsql + community.general.zypper: + name: icinga2-ido-pgsql + state: present diff --git a/roles/icingadb/meta/main.yml b/roles/icingadb/meta/main.yml index de56b28a..361984cc 100644 --- a/roles/icingadb/meta/main.yml +++ b/roles/icingadb/meta/main.yml @@ -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 diff --git a/roles/icingadb/tasks/install_on_suse.yml b/roles/icingadb/tasks/install_on_suse.yml new file mode 100644 index 00000000..20dda437 --- /dev/null +++ b/roles/icingadb/tasks/install_on_suse.yml @@ -0,0 +1,4 @@ +- name: Suse - Install IcingaDB packages + community.general.zypper: + name: "{{ icingadb_packages }}" + state: present diff --git a/roles/icingadb_redis/meta/main.yml b/roles/icingadb_redis/meta/main.yml index c83ecb2b..72393b09 100644 --- a/roles/icingadb_redis/meta/main.yml +++ b/roles/icingadb_redis/meta/main.yml @@ -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 diff --git a/roles/icingadb_redis/tasks/install_on_suse.yml b/roles/icingadb_redis/tasks/install_on_suse.yml new file mode 100644 index 00000000..d40ff048 --- /dev/null +++ b/roles/icingadb_redis/tasks/install_on_suse.yml @@ -0,0 +1,5 @@ +--- +- name: Suse - install icingadb packages + community.general.zypper: + name: "{{ icingadb_redis_packages }}" + state: present diff --git a/roles/icingaweb2/meta/main.yml b/roles/icingaweb2/meta/main.yml index 06c53a53..61e49d68 100644 --- a/roles/icingaweb2/meta/main.yml +++ b/roles/icingaweb2/meta/main.yml @@ -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 diff --git a/roles/icingaweb2/tasks/install_on_suse.yml b/roles/icingaweb2/tasks/install_on_suse.yml new file mode 100644 index 00000000..b8588c5b --- /dev/null +++ b/roles/icingaweb2/tasks/install_on_suse.yml @@ -0,0 +1,5 @@ +--- +- name: Suse - Install Icinga Web 2 packages + community.general.zypper: + name: "{{ icingaweb2_packages }}" + state: present diff --git a/roles/icingaweb2/tasks/manage_icingaweb_config.yml b/roles/icingaweb2/tasks/manage_icingaweb_config.yml index 4574e123..517afbf1 100644 --- a/roles/icingaweb2/tasks/manage_icingaweb_config.yml +++ b/roles/icingaweb2/tasks/manage_icingaweb_config.yml @@ -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: @@ -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: diff --git a/roles/icingaweb2/vars/suse.yml b/roles/icingaweb2/vars/suse.yml new file mode 100644 index 00000000..ed99ea69 --- /dev/null +++ b/roles/icingaweb2/vars/suse.yml @@ -0,0 +1,4 @@ +--- +icingaweb2_httpd_user: wwwrun +icingaweb2_fragments_path: /var/tmp/icingaweb +icingaweb2_packages: ["icingaweb2", "icingacli"] diff --git a/roles/repos/defaults/main.yml b/roles/repos/defaults/main.yml index 852c137d..24fc28ab 100644 --- a/roles/repos/defaults/main.yml +++ b/roles/repos/defaults/main.yml @@ -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" diff --git a/roles/repos/meta/main.yml b/roles/repos/meta/main.yml index d2567bc7..09681703 100644 --- a/roles/repos/meta/main.yml +++ b/roles/repos/meta/main.yml @@ -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 diff --git a/roles/repos/tasks/Debian.yml b/roles/repos/tasks/Debian.yml index e1936f84..b8ddb526 100644 --- a/roles/repos/tasks/Debian.yml +++ b/roles/repos/tasks/Debian.yml @@ -1,6 +1,6 @@ --- - name: Apt - ensure apt keyrings directory - file: + ansible.builtin.file: state: directory path: /etc/apt/keyrings owner: root diff --git a/roles/repos/tasks/Suse.yml b/roles/repos/tasks/Suse.yml new file mode 100644 index 00000000..4b713bb8 --- /dev/null +++ b/roles/repos/tasks/Suse.yml @@ -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' }}"