Adding fallback mechanism to ntp validation role

It the 'chrony_enabled' key isn't found by hiera, the validation
will now proceed as if it was disabled. This should allow for successful
run on clouds with mix of ntp implementations.

Resolves: rhbz#2156049

Signed-off-by: Jiri Podivin <jpodivin@redhat.com>
Change-Id: Ic9860b3531639e85926f5221cd9c5cde03eecfa8
(cherry picked from commit 726898e1e1)
This commit is contained in:
Jiri Podivin 2023-01-02 14:38:26 +01:00
parent b69991cebe
commit 04e049a232
1 changed files with 8 additions and 2 deletions

View File

@ -1,8 +1,14 @@
---
- name: Get if chrony is enabled
become: true
hiera:
name: "chrony_enabled"
block:
- hiera:
name: "chrony_enabled"
rescue:
- debug:
msg: "chrony_enabled key is not present. Assuming chrony is disabled"
- set_fact:
chrony_enabled: false
- when: chrony_enabled|bool
block: