Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions changelogs/fragments/fix_410_sources-dot-list.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
minor_changes:
- The error messages about unsupported operating systems have been tuned. They should now appear if and only if the actual OS is in fact not supported instead of appearing after unrelated task failures.
- The deb repositories made available by the :code:`repos` role now use the `deb822 format <https://repolib.readthedocs.io/en/latest/deb822-format.html>`__.
This can lead to APT warnings on systems that already have the repositories deployed using the old format (sources.list). To fix this, simply remove the old :code:`icinga.list` file after the repositories have been deployed in the new format.
14 changes: 7 additions & 7 deletions molecule/default/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
hosts: all
vars:
icingaweb2_modules:
businessprocess:
enabled: true
source: package
custom_process_files:
- name: test.conf
src_path: test.conf
graphite:
enabled: true
source: package
Expand Down Expand Up @@ -48,6 +54,7 @@
host: "127.0.0.1"
monitoring:
enabled: false
source: package
backends:
icinga2_ido_mysql:
type: ido
Expand Down Expand Up @@ -120,13 +127,6 @@
- zones.d/main/commands
- zones.d/main/hosts
- zones.d/main/services
icingaweb2_modules:
businessprocess:
enabled: true
source: package
custom_process_files:
- name: test.conf
src_path: test.conf
collections:
- netways.icinga
pre_tasks:
Expand Down
1 change: 1 addition & 0 deletions molecule/default/prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@
name:
- gpg
- apt-transport-https
- python3-debian
update_cache: yes
when: ansible_os_family == "Debian"
1 change: 1 addition & 0 deletions molecule/local-default-pgsql/prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
name:
- gpg
- apt-transport-https
- python3-debian
update_cache: yes
when: ansible_os_family == "Debian"
1 change: 1 addition & 0 deletions molecule/local-default/prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
name:
- gpg
- apt-transport-https
- python3-debian
update_cache: yes
when: ansible_os_family == "Debian"
1 change: 1 addition & 0 deletions molecule/role-icingadb/prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@
name:
- gpg
- apt-transport-https
- python3-debian
update_cache: yes
when: ansible_os_family == "Debian"
1 change: 1 addition & 0 deletions molecule/role-icingadb_redis/prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@
name:
- gpg
- apt-transport-https
- python3-debian
update_cache: yes
when: ansible_os_family == "Debian"
1 change: 1 addition & 0 deletions molecule/role-icingaweb2/prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@
name:
- gpg
- apt-transport-https
- python3-debian
update_cache: yes
when: ansible_os_family == "Debian"
10 changes: 8 additions & 2 deletions roles/icinga2/tasks/install.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
---
- name: Check supported operatingsystems
vars:
_paths: "{{ ansible_search_path }}"
_file: "install_on_{{ ansible_os_family }}.yml"
_tasks_file: "{{ lookup('first_found', paths=_paths, files=_file, skip=true) }}"
block:
- name: Install on {{ ansible_os_family }}
when: _tasks_file | length > 0
ansible.builtin.include_tasks: "install_on_{{ ansible_os_family }}.yml"
rescue:

- name: "OS family not supported!"
when: _tasks_file | length == 0
ansible.builtin.fail:
msg: "The OS {{ ansible_os_family }} is not supported!"
msg: "The OS '{{ ansible_os_family }}' is not supported!"

- name: Prepare fragments path
ansible.builtin.file:
Expand Down
10 changes: 8 additions & 2 deletions roles/icinga_kubernetes/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,19 @@
- "{{ role_path }}/vars"

- name: Check supported operatingsystems
vars:
_paths: "{{ ansible_search_path }}"
_file: "install_on_{{ ansible_os_family | lower }}.yml"
_tasks_file: "{{ lookup('first_found', paths=_paths, files=_file, skip=true) }}"
block:
- name: Include OS specific installation
when: _tasks_file | length > 0
ansible.builtin.include_tasks: "install_on_{{ ansible_os_family | lower }}.yml"
rescue:

- name: "OS family not supported!"
when: _tasks_file | length == 0
ansible.builtin.fail:
msg: "The OS {{ ansible_os_family }} is not supported!"
msg: "The OS '{{ ansible_os_family }}' is not supported!"

- name: Include Tasks to configure Icinga Kubernetes
ansible.builtin.include_tasks: manage_config.yml
Expand Down
10 changes: 8 additions & 2 deletions roles/icingadb/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,19 @@
- "{{ role_path }}/vars"

- name: Check supported operatingsystems
vars:
_paths: "{{ ansible_search_path }}"
_file: "install_on_{{ ansible_os_family | lower }}.yml"
_tasks_file: "{{ lookup('first_found', paths=_paths, files=_file, skip=true) }}"
block:
- name: Include OS specific installation
when: _tasks_file | length > 0
ansible.builtin.include_tasks: "install_on_{{ ansible_os_family | lower }}.yml"
rescue:

- name: "OS family not supported!"
when: _tasks_file | length == 0
ansible.builtin.fail:
msg: "The OS {{ ansible_os_family }} is not supported!"
msg: "The OS '{{ ansible_os_family }}' is not supported!"

- name: Include Tasks to configure IcingaDB
ansible.builtin.include_tasks: manage_config.yml
Expand Down
10 changes: 8 additions & 2 deletions roles/icingadb_redis/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,19 @@
- "{{ role_path }}/vars"

- name: Check supported operatingsystems
vars:
_paths: "{{ ansible_search_path }}"
_file: "install_on_{{ ansible_os_family | lower }}.yml"
_tasks_file: "{{ lookup('first_found', paths=_paths, files=_file, skip=true) }}"
block:
- name: Include OS specific installation
when: _tasks_file | length > 0
ansible.builtin.include_tasks: "install_on_{{ ansible_os_family | lower }}.yml"
rescue:

- name: "OS family not supported!"
when: _tasks_file | length == 0
ansible.builtin.fail:
msg: "The OS {{ ansible_os_family }} is not supported!"
msg: "The OS '{{ ansible_os_family }}' is not supported!"

- name: Manage IcingaDB Redis configuration
ansible.builtin.include_tasks: "manage_config.yml"
Expand Down
10 changes: 8 additions & 2 deletions roles/icingaweb2/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,19 @@
no_log: true

- name: Check supported operatingsystems
vars:
_paths: "{{ ansible_search_path }}"
_file: "install_on_{{ ansible_os_family | lower }}.yml"
_tasks_file: "{{ lookup('first_found', paths=_paths, files=_file, skip=true) }}"
block:
- name: Include OS specific installation
when: _tasks_file | length > 0
ansible.builtin.include_tasks: "install_on_{{ ansible_os_family | lower }}.yml"
rescue:

- name: "OS family not supported!"
when: _tasks_file | length == 0
ansible.builtin.fail:
msg: "The OS {{ ansible_os_family }} is not supported!"
msg: "The OS '{{ ansible_os_family }}' is not supported!"

- name: Manage Icinga Web 2 config
ansible.builtin.include_tasks: "manage_icingaweb_config.yml"
Expand Down
10 changes: 8 additions & 2 deletions roles/monitoring_plugins/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,19 @@
- gather_facts:

- name: Check supported operatingsystems
vars:
_paths: "{{ role_path }}/vars"
_file: "{{ ansible_os_family }}.yml"
_tasks_file: "{{ lookup('first_found', paths=_paths, files=_file, skip=true) }}"
block:
- name: Include OS family specific vars
when: _tasks_file | length > 0
ansible.builtin.include_vars: "{{ role_path }}/vars/{{ ansible_os_family }}.yml"
rescue:

- name: "OS family not supported!"
when: _tasks_file | length == 0
ansible.builtin.fail:
msg: "The OS {{ ansible_os_family }} is not supported!"
msg: "The OS '{{ ansible_os_family }}' is not supported!"

- name: Include OS distribution/version specific vars
include_vars: "{{ lookup('first_found', params) }}"
Expand Down
7 changes: 4 additions & 3 deletions roles/repos/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ icinga_repo_zypper_snapshot_url: "https://packages.icinga.com/openSUSE/$releasev

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"
icinga_repo_apt_testing_deb: "deb [signed-by={{ icinga_repo_apt_keyring }}] http://packages.icinga.com/{{ ansible_distribution|lower }} icinga-{{ ansible_distribution_release|lower }}-testing main"
icinga_repo_apt_snapshot_deb: "deb [signed-by={{ icinga_repo_apt_keyring }}] http://packages.icinga.com/{{ ansible_distribution|lower }} icinga-{{ ansible_distribution_release|lower }}-snapshots main"
icinga_repo_apt_url: "http://packages.icinga.com/{{ ansible_distribution | lower }}"
icinga_repo_apt_stable_deb: "icinga-{{ ansible_distribution_release | lower }}"
icinga_repo_apt_testing_deb: "icinga-{{ ansible_distribution_release | lower }}-testing"
icinga_repo_apt_snapshot_deb: "icinga-{{ ansible_distribution_release | lower }}-snapshots"

icinga_repo_gpgkey: "https://packages.icinga.com/icinga.key"
icinga_repo_stable: true
Expand Down
39 changes: 21 additions & 18 deletions roles/repos/tasks/Debian.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---

- name: Apt - ensure apt keyrings directory
ansible.builtin.file:
state: directory
Expand All @@ -16,21 +17,23 @@
mode: '0644'
force: true

- name: Apt - add Icinga repository (stable)
become: yes
apt_repository:
filename: /etc/apt/sources.list.d/icinga
repo: "{{ icinga_repo_apt_stable_deb }}"
state: "{{ 'present' if icinga_repo_stable else 'absent' }}"
- name: Apt - add Icinga repository (testing)
become: yes
apt_repository:
filename: /etc/apt/sources.list.d/icinga
repo: "{{ icinga_repo_apt_testing_deb }}"
state: "{{ 'present' if icinga_repo_testing else 'absent' }}"
- name: Apt - add Icinga repository (snapshot)
become: yes
apt_repository:
filename: /etc/apt/sources.list.d/icinga
repo: "{{ icinga_repo_apt_snapshot_deb }}"
state: "{{ 'present' if icinga_repo_snapshot else 'absent' }}"
- name: Apt - add Icinga repository
ansible.builtin.deb822_repository:
state: present
name: icinga
types: deb
uris: "{{ icinga_repo_apt_url }}"
suites: "{{
([icinga_repo_apt_stable_deb]) +
([icinga_repo_apt_testing_deb] if icinga_repo_testing else []) +
([icinga_repo_apt_snapshot_deb] if icinga_repo_snapshot else [])
}}"
components:
- main
signed_by: "{{ icinga_repo_apt_keyring }}"
register: _apt_repo

- name: Apt - update cache
when: _apt_repo.changed
ansible.builtin.apt:
update_cache: true
10 changes: 8 additions & 2 deletions roles/repos/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,16 @@
- icinga_repo_subscription_password is defined

- name: Check OS family
vars:
_paths: "{{ ansible_search_path }}"
_file: "{{ ansible_os_family }}.yml"
_tasks_file: "{{ lookup('first_found', paths=_paths, files=_file, skip=true) }}"
block:
- name: Add repositories {{ ansible_os_family }}
when: _tasks_file | length > 0
ansible.builtin.include_tasks: "{{ ansible_os_family }}.yml"
rescue:

- name: "OS family not supported!"
when: _tasks_file | length == 0
ansible.builtin.fail:
msg: "The OS '{{ ansible_os_family }}' isn't currently supported!"
msg: "The OS '{{ ansible_os_family }}' is not supported!"