Skip to content

Commit 86e48db

Browse files
committed
Switch to deb822 format
1 parent 0e4cad9 commit 86e48db

File tree

10 files changed

+78
-35
lines changed

10 files changed

+78
-35
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
minor_changes:
2+
- 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.
3+
- The deb repositories made available by the :code:`repos` role now use the `deb822 format <https://repolib.readthedocs.io/en/latest/deb822-format.html>`__.
4+
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.

roles/icinga2/tasks/install.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
---
22
- name: Check supported operatingsystems
3+
vars:
4+
_paths: "{{ ansible_search_path }}"
5+
_file: "install_on_{{ ansible_os_family }}.yml"
6+
_tasks_file: "{{ lookup('first_found', paths=_paths, files=_file, skip=true) }}"
37
block:
48
- name: Install on {{ ansible_os_family }}
9+
when: _tasks_file | length > 0
510
ansible.builtin.include_tasks: "install_on_{{ ansible_os_family }}.yml"
6-
rescue:
11+
712
- name: "OS family not supported!"
13+
when: _tasks_file | length == 0
814
ansible.builtin.fail:
9-
msg: "The OS {{ ansible_os_family }} is not supported!"
15+
msg: "The OS '{{ ansible_os_family }}' is not supported!"
1016

1117
- name: Prepare fragments path
1218
ansible.builtin.file:

roles/icinga_kubernetes/tasks/main.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,19 @@
1313
- "{{ role_path }}/vars"
1414

1515
- name: Check supported operatingsystems
16+
vars:
17+
_paths: "{{ ansible_search_path }}"
18+
_file: "install_on_{{ ansible_os_family | lower }}.yml"
19+
_tasks_file: "{{ lookup('first_found', paths=_paths, files=_file, skip=true) }}"
1620
block:
1721
- name: Include OS specific installation
22+
when: _tasks_file | length > 0
1823
ansible.builtin.include_tasks: "install_on_{{ ansible_os_family | lower }}.yml"
19-
rescue:
24+
2025
- name: "OS family not supported!"
26+
when: _tasks_file | length == 0
2127
ansible.builtin.fail:
22-
msg: "The OS {{ ansible_os_family }} is not supported!"
28+
msg: "The OS '{{ ansible_os_family }}' is not supported!"
2329

2430
- name: Include Tasks to configure Icinga Kubernetes
2531
ansible.builtin.include_tasks: manage_config.yml

roles/icingadb/tasks/main.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,19 @@
1313
- "{{ role_path }}/vars"
1414

1515
- name: Check supported operatingsystems
16+
vars:
17+
_paths: "{{ ansible_search_path }}"
18+
_file: "install_on_{{ ansible_os_family | lower }}.yml"
19+
_tasks_file: "{{ lookup('first_found', paths=_paths, files=_file, skip=true) }}"
1620
block:
1721
- name: Include OS specific installation
22+
when: _tasks_file | length > 0
1823
ansible.builtin.include_tasks: "install_on_{{ ansible_os_family | lower }}.yml"
19-
rescue:
24+
2025
- name: "OS family not supported!"
26+
when: _tasks_file | length == 0
2127
ansible.builtin.fail:
22-
msg: "The OS {{ ansible_os_family }} is not supported!"
28+
msg: "The OS '{{ ansible_os_family }}' is not supported!"
2329

2430
- name: Include Tasks to configure IcingaDB
2531
ansible.builtin.include_tasks: manage_config.yml

roles/icingadb_redis/tasks/main.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,19 @@
1313
- "{{ role_path }}/vars"
1414

1515
- name: Check supported operatingsystems
16+
vars:
17+
_paths: "{{ ansible_search_path }}"
18+
_file: "install_on_{{ ansible_os_family | lower }}.yml"
19+
_tasks_file: "{{ lookup('first_found', paths=_paths, files=_file, skip=true) }}"
1620
block:
1721
- name: Include OS specific installation
22+
when: _tasks_file | length > 0
1823
ansible.builtin.include_tasks: "install_on_{{ ansible_os_family | lower }}.yml"
19-
rescue:
24+
2025
- name: "OS family not supported!"
26+
when: _tasks_file | length == 0
2127
ansible.builtin.fail:
22-
msg: "The OS {{ ansible_os_family }} is not supported!"
28+
msg: "The OS '{{ ansible_os_family }}' is not supported!"
2329

2430
- name: Manage IcingaDB Redis configuration
2531
ansible.builtin.include_tasks: "manage_config.yml"

roles/icingaweb2/tasks/main.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,19 @@
3535
no_log: true
3636

3737
- name: Check supported operatingsystems
38+
vars:
39+
_paths: "{{ ansible_search_path }}"
40+
_file: "install_on_{{ ansible_os_family | lower }}.yml"
41+
_tasks_file: "{{ lookup('first_found', paths=_paths, files=_file, skip=true) }}"
3842
block:
3943
- name: Include OS specific installation
44+
when: _tasks_file | length > 0
4045
ansible.builtin.include_tasks: "install_on_{{ ansible_os_family | lower }}.yml"
41-
rescue:
46+
4247
- name: "OS family not supported!"
48+
when: _tasks_file | length == 0
4349
ansible.builtin.fail:
44-
msg: "The OS {{ ansible_os_family }} is not supported!"
50+
msg: "The OS '{{ ansible_os_family }}' is not supported!"
4551

4652
- name: Manage Icinga Web 2 config
4753
ansible.builtin.include_tasks: "manage_icingaweb_config.yml"

roles/monitoring_plugins/tasks/main.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,19 @@
33
- gather_facts:
44

55
- name: Check supported operatingsystems
6+
vars:
7+
_paths: "{{ role_path }}/vars"
8+
_file: "{{ ansible_os_family }}.yml"
9+
_tasks_file: "{{ lookup('first_found', paths=_paths, files=_file, skip=true) }}"
610
block:
711
- name: Include OS family specific vars
12+
when: _tasks_file | length > 0
813
ansible.builtin.include_vars: "{{ role_path }}/vars/{{ ansible_os_family }}.yml"
9-
rescue:
14+
1015
- name: "OS family not supported!"
16+
when: _tasks_file | length == 0
1117
ansible.builtin.fail:
12-
msg: "The OS {{ ansible_os_family }} is not supported!"
18+
msg: "The OS '{{ ansible_os_family }}' is not supported!"
1319

1420
- name: Include OS distribution/version specific vars
1521
include_vars: "{{ lookup('first_found', params) }}"

roles/repos/defaults/main.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@ icinga_repo_zypper_snapshot_url: "https://packages.icinga.com/openSUSE/$releasev
1717

1818
icinga_repo_apt_key: "{{ icinga_repo_gpgkey }}"
1919
icinga_repo_apt_keyring: /etc/apt/keyrings/icinga-archive-keyring.asc
20-
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"
21-
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"
22-
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"
20+
icinga_repo_apt_url: "http://packages.icinga.com/{{ ansible_distribution | lower }}"
21+
icinga_repo_apt_stable_deb: "icinga-{{ ansible_distribution_release | lower }}"
22+
icinga_repo_apt_testing_deb: "icinga-{{ ansible_distribution_release | lower }}-testing"
23+
icinga_repo_apt_snapshot_deb: "icinga-{{ ansible_distribution_release | lower }}-snapshots"
2324

2425
icinga_repo_gpgkey: "https://packages.icinga.com/icinga.key"
2526
icinga_repo_stable: true

roles/repos/tasks/Debian.yml

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
---
2+
23
- name: Apt - ensure apt keyrings directory
34
ansible.builtin.file:
45
state: directory
@@ -16,21 +17,16 @@
1617
mode: '0644'
1718
force: true
1819

19-
- name: Apt - add Icinga repository (stable)
20-
become: yes
21-
apt_repository:
22-
filename: /etc/apt/sources.list.d/icinga
23-
repo: "{{ icinga_repo_apt_stable_deb }}"
24-
state: "{{ 'present' if icinga_repo_stable else 'absent' }}"
25-
- name: Apt - add Icinga repository (testing)
26-
become: yes
27-
apt_repository:
28-
filename: /etc/apt/sources.list.d/icinga
29-
repo: "{{ icinga_repo_apt_testing_deb }}"
30-
state: "{{ 'present' if icinga_repo_testing else 'absent' }}"
31-
- name: Apt - add Icinga repository (snapshot)
32-
become: yes
33-
apt_repository:
34-
filename: /etc/apt/sources.list.d/icinga
35-
repo: "{{ icinga_repo_apt_snapshot_deb }}"
36-
state: "{{ 'present' if icinga_repo_snapshot else 'absent' }}"
20+
- name: Apt - add Icinga repository
21+
ansible.builtin.deb822_repository:
22+
state: present
23+
name: icinga
24+
types: deb
25+
uris: "{{ icinga_repo_apt_url }}"
26+
suites:
27+
- "{{ icinga_repo_apt_stable_deb }}"
28+
- "{{ icinga_repo_apt_testing_deb if icinga_repo_testing else omit }}"
29+
- "{{ icinga_repo_apt_snapshot_deb if icinga_repo_snapshot else omit }}"
30+
components:
31+
- main
32+
signed_by: "{{ icinga_repo_apt_keyring }}"

roles/repos/tasks/main.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,16 @@
3030
- icinga_repo_subscription_password is defined
3131

3232
- name: Check OS family
33+
vars:
34+
_paths: "{{ ansible_search_path }}"
35+
_file: "{{ ansible_os_family }}.yml"
36+
_tasks_file: "{{ lookup('first_found', paths=_paths, files=_file, skip=true) }}"
3337
block:
3438
- name: Add repositories {{ ansible_os_family }}
39+
when: _tasks_file | length > 0
3540
ansible.builtin.include_tasks: "{{ ansible_os_family }}.yml"
36-
rescue:
41+
3742
- name: "OS family not supported!"
43+
when: _tasks_file | length == 0
3844
ansible.builtin.fail:
39-
msg: "The OS '{{ ansible_os_family }}' isn't currently supported!"
45+
msg: "The OS '{{ ansible_os_family }}' is not supported!"

0 commit comments

Comments
 (0)