Skip to content

Commit 1f7ba22

Browse files
authored
Fix/proper fail on unsupported os (#258)
* Added block rescue statement if unsupported os found. * added changelog fragment
1 parent a2ad28c commit 1f7ba22

File tree

7 files changed

+51
-15
lines changed

7 files changed

+51
-15
lines changed

changelogs/fragments/minor_changes.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
bugfixes:
33
- "icingaweb2: run pqslcmd with LANG=C to ensure the output is in english."
44
- remove superfluous curly brace (#246)
5+
- Added block rescue statement if unsupported os found. (#232)
56
minor_changes:
67
- added tests for icingaweb2 ini template
78
- added pyinilint as ini validator after templates

roles/icinga2/tasks/install.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
---
2+
- name: Check supported operatingsystems
3+
block:
4+
- name: Install on {{ ansible_os_family }}
5+
ansible.builtin.include_tasks: "install_on_{{ ansible_os_family }}.yml"
6+
rescue:
7+
- name: "OS family not supported!"
8+
ansible.builtin.fail:
9+
msg: "The OS {{ ansible_os_family }} is not supported!"
210

3-
- name: install on {{ ansible_os_family }}
4-
include_tasks: "install_on_{{ ansible_os_family }}.yml"
5-
6-
- name: fragments dir
7-
file:
11+
- name: Prepare fragments path
12+
ansible.builtin.file:
813
state: directory
914
path: "{{ icinga2_fragments_path }}"
1015
owner: root

roles/icingadb/tasks/main.yml

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

15-
- name: Include OS specific installation
16-
ansible.builtin.include_tasks: "install_on_{{ ansible_os_family | lower }}.yml"
15+
- name: Check supported operatingsystems
16+
block:
17+
- name: Include OS specific installation
18+
ansible.builtin.include_tasks: "install_on_{{ ansible_os_family | lower }}.yml"
19+
rescue:
20+
- name: "OS family not supported!"
21+
ansible.builtin.fail:
22+
msg: "The OS {{ ansible_os_family }} is not supported!"
1723

1824
- name: Include Tasks to configure IcingaDB
1925
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
@@ -12,8 +12,14 @@
1212
paths:
1313
- "{{ role_path }}/vars"
1414

15-
- name: Include OS specific installation
16-
ansible.builtin.include_tasks: "install_on_{{ ansible_os_family | lower }}.yml"
15+
- name: Check supported operatingsystems
16+
block:
17+
- name: Include OS specific installation
18+
ansible.builtin.include_tasks: "install_on_{{ ansible_os_family | lower }}.yml"
19+
rescue:
20+
- name: "OS family not supported!"
21+
ansible.builtin.fail:
22+
msg: "The OS {{ ansible_os_family }} is not supported!"
1723

1824
- name: Manage IcingaDB Redis configuration
1925
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
@@ -18,8 +18,14 @@
1818
loop: "{{ icingaweb2_modules | dict2items }}"
1919
when: icingaweb2_modules is defined and icingaweb2_module_packages[item.key] is defined and item.value.enabled | bool == true and item.value.source == "package"
2020

21-
- name: Include OS specific installation
22-
ansible.builtin.include_tasks: "install_on_{{ ansible_os_family | lower }}.yml"
21+
- name: Check supported operatingsystems
22+
block:
23+
- name: Include OS specific installation
24+
ansible.builtin.include_tasks: "install_on_{{ ansible_os_family | lower }}.yml"
25+
rescue:
26+
- name: "OS family not supported!"
27+
ansible.builtin.fail:
28+
msg: "The OS {{ ansible_os_family }} is not supported!"
2329

2430
- name: Manage Icinga Web 2 config
2531
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
@@ -2,8 +2,14 @@
22

33
- gather_facts:
44

5-
- name: Include OS family specific vars
6-
include_vars: "{{ role_path }}/vars/{{ ansible_os_family }}.yml"
5+
- name: Check supported operatingsystems
6+
block:
7+
- name: Include OS family specific vars
8+
ansible.builtin.include_vars: "{{ role_path }}/vars/{{ ansible_os_family }}.yml"
9+
rescue:
10+
- name: "OS family not supported!"
11+
ansible.builtin.fail:
12+
msg: "The OS {{ ansible_os_family }} is not supported!"
713

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

roles/repos/tasks/main.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,11 @@
2929
- icinga_repo_subscription_username is defined
3030
- icinga_repo_subscription_password is defined
3131

32-
- name: Add repositories
33-
ansible.builtin.include_tasks: "{{ ansible_os_family }}.yml"
32+
- name: Check OS family
33+
block:
34+
- name: Add repositories {{ ansible_os_family }}
35+
ansible.builtin.include_tasks: "{{ ansible_os_family }}.yml"
36+
rescue:
37+
- name: "OS family not supported!"
38+
ansible.builtin.fail:
39+
msg: "The OS '{{ ansible_os_family }}' isn't currently supported!"

0 commit comments

Comments
 (0)