Skip to content

fix(tasks): correct mount audit logic and variable naming in section 1#333

Open
teebee wants to merge 1 commit intoansible-lockdown:develfrom
teebee:fix/mount-audit-logic-section-1
Open

fix(tasks): correct mount audit logic and variable naming in section 1#333
teebee wants to merge 1 commit intoansible-lockdown:develfrom
teebee:fix/mount-audit-logic-section-1

Conversation

@teebee
Copy link
Copy Markdown

@teebee teebee commented Mar 25, 2026

Overall Review of Changes:
This PR corrects critical logical errors and variable naming inconsistencies in the partition audit tasks of Section 1 (Benchmarks 1.1.2.1.x through 1.1.2.7.x).

  1. Variable naming: Fixed copy-paste errors where tasks for /home and /var incorrectly referenced discovered_dev_shm_mount instead of their own registered variables.
  2. Logic fix: Changed the check from is undefined to .rc != 0. Since the preceding command task uses register, the variable is always defined, which previously caused the audit warnings to be skipped entirely.

Issue Fixes:
N/A (Found during manual code review and verified via testing)

Enhancements:

  • Improved reliability of the audit summary by ensuring that missing partitions are correctly detected and added to the warn_control_list.
  • Standardized the audit check pattern across all mount-related tasks in Section 1.

How has this been tested?:
Verified using a dedicated test playbook on an Ubuntu 22.04 VM.

  • Scenario A (Missing partition): Confirmed that findmnt returns RC 1, and the new .rc != 0 logic correctly triggers the warning and includes it in the warning_facts summary.
  • Scenario B (Existing partition): Confirmed that the task is skipped as expected when .rc == 0.

Fixed copy-paste errors where tasks referenced incorrect mount variables. Updated logic from 'is undefined' to '.rc != 0' to ensure audit warnings are correctly triggered when partitions are missing, as 'register' always defines the variable.

Signed-off-by: teebee <733833@gmx.de>
@github-actions
Copy link
Copy Markdown

Congrats on opening your first pull request and thank you for taking the time to help improve Ansible-Lockdown!
Please join in the conversation happening on the Discord Server as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant