test: add cleanup for cron test; fix formatting

Ensure cron test restores state of crontab after test.
Fix formatting in a few places.
Do not check ansible managed header and fingerprint unless the test
uses a custom template with header and fingerprint.
Use default for gather_facts unless otherwise needed.

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
This commit is contained in:
Rich Megginson
2025-01-07 11:31:56 -07:00
committed by Richard Megginson
parent 2c0be7a450
commit 129feb1ac1
5 changed files with 98 additions and 67 deletions
+9 -6
View File
@@ -2,14 +2,17 @@
---
- name: Ensure that the role runs with default parameters
hosts: all
gather_facts: false # test that role works in this case
roles:
- role: linux-system-roles.aide
vars:
aide_init: true
tasks:
- name: Check header for ansible_managed, fingerprint
include_tasks: tasks/check_not_present_header.yml
vars:
__file: /etc/aide.conf
__fingerprint: system_role:aide
- name: Check if the file exists
ansible.builtin.stat:
path: /etc/aide.conf
register: file_check
- name: Assert that the file exists
ansible.builtin.assert:
that: file_check.stat.exists
fail_msg: The file does not exist.