From cc5de8664f64500af1270dd3f76e7eebeceb154a Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Fri, 31 Jan 2025 14:24:18 -0700 Subject: [PATCH] feat: ensure role works on ostree systems Ensure role works on ostree systems Signed-off-by: Rich Megginson --- .ostree/packages-runtime.txt | 2 ++ tests/tests_check_cron.yml | 15 +++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 .ostree/packages-runtime.txt diff --git a/.ostree/packages-runtime.txt b/.ostree/packages-runtime.txt new file mode 100644 index 0000000..1de5817 --- /dev/null +++ b/.ostree/packages-runtime.txt @@ -0,0 +1,2 @@ +aide +crontabs diff --git a/tests/tests_check_cron.yml b/tests/tests_check_cron.yml index 2ebd41a..8ef7812 100644 --- a/tests/tests_check_cron.yml +++ b/tests/tests_check_cron.yml @@ -3,9 +3,24 @@ - name: Ensure that the cron is set up hosts: all tasks: + - name: Determine if system is ostree and set flag + when: not __aide_is_ostree is defined + block: + - name: Check if system is ostree + stat: + path: /run/ostree-booted + register: __ostree_booted_stat + + - name: Set flag to indicate system is ostree + set_fact: + __aide_is_ostree: "{{ __ostree_booted_stat.stat.exists }}" + - name: Install crontabs package: name: crontabs + state: present + use: "{{ (__aide_is_ostree | d(false)) | + ternary('ansible.posix.rhel_rpm_ostree', omit) }}" - name: Create tempfile for crontab backup tempfile: