Files
ansible-role-aide/tasks/set_vars.yml
T
Rich MegginsonandRichard Megginson 659d89dd69 feat: add role fingerprints to syslog
Feature: Add a fingerprint string to the system log to indicate when the role began
successfully, and when the role finished successfully.  The fingerprint string indicates
the role name, a timestamp, and the platform.

Reason: Users can see when the role was used and if it was used successfully.  This
information from the system log can be collected by log scanners and aggregators
for further analysis.

Result: The role logs fingerprints to the system log.

This also adds a test to check if the fingerprints were written upon a successful
role invocation.

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2026-04-22 10:52:25 -06:00

40 lines
1.3 KiB
YAML

---
- name: Ensure ansible_facts used by role
setup:
gather_subset: "{{ __aide_required_facts_subsets }}"
when: __aide_required_facts |
difference(ansible_facts.keys() | list) | length > 0
- name: Record role begin fingerprint
sr_fingerprint:
sr_message: >-
begin system_role:aide ansible_version={{ ansible_version.full }}
{{ ansible_facts['distribution'] }}-{{ ansible_facts['distribution_version'] }}
- 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: Set platform/version specific variables
include_vars: "{{ __vars_file }}"
loop:
- "{{ ansible_facts['os_family'] }}.yml"
- "{{ ansible_facts['distribution'] }}.yml"
- >-
{{ ansible_facts['distribution'] ~ '_' ~
ansible_facts['distribution_major_version'] }}.yml
- >-
{{ ansible_facts['distribution'] ~ '_' ~
ansible_facts['distribution_version'] }}.yml
vars:
__vars_file: "{{ role_path }}/vars/{{ item }}"
when: __vars_file is file