From 8a38650658ed5fc7044395e465990c0000abe892 Mon Sep 17 00:00:00 2001 From: Shawn Hardwick Date: Wed, 5 Feb 2025 11:59:30 -0500 Subject: [PATCH] Add ignore_apt_update_changed_when default variable to allow users to specify changed_when behavior of apt update task; allows for idempotency checks (like Molecule) Signed-off-by: Shawn Hardwick --- defaults/main.yml | 4 ++++ tasks/prelim.yml | 1 + 2 files changed, 5 insertions(+) diff --git a/defaults/main.yml b/defaults/main.yml index d37ae5e..54d7aac 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -626,6 +626,10 @@ ubtu24cis_desktop_required: false # This will also purge any packages not removed via this playbook ubtu24cis_purge_apt: false +## Ignore change_when for apt update task +# Modifies behavior of 'changed_when' for 'apt update' task in prelim that always changes +ignore_apt_update_changed_when: false + ## ## Section 1 Control Variables ## diff --git a/tasks/prelim.yml b/tasks/prelim.yml index c5eac21..8dbd904 100644 --- a/tasks/prelim.yml +++ b/tasks/prelim.yml @@ -55,6 +55,7 @@ tags: always ansible.builtin.package: update_cache: true + changed_when: not ignore_apt_update_changed_when - name: Include audit specific variables when: