Use this when compliance failures should be fixed automatically.
Auto-remediation · Compliance Automation
Auto-remediation in compliance automation fixes non-compliant settings automatically when a check fails, such as re-enabling a firewall or resetting a weak SSH setting, with approval rules for risky changes.
1. Auto-remediation fixes common compliance failures.
2. Only safe controls.
3. Test on non-prod.
4. Log and report.
5. Ticket the rest.
failed control → remediation → rescan
Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
ansible-playbook --check --diff <playbook.yml>Primary Commands
Configuration and operational commands for this Topic.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Known-good, broken and when it is fixed Verify boundary
Verification for Compliance Automation → Auto-remediation must discriminate known-good from broken/suspicious state. With ansible-playbook --check --diff <playbook.yml>, known-good is: the intended steady state reports no unexpected changes or the planned delta matches the approved remediation. Broken/suspicious is: unexpected changes or repeated predicted changes indicate drift/idempotency problems. Read back the same target after the minimal approved change, then review module check-mode support and perform bounded post-change read-back; check mode is not a guarantee of zero side effects.
Step 2 Common mistakes Narrow the fault
- Auto-remediation reverting legitimate emergency changes.
Step 3 Observation-driven troubleshooting tree Narrow the fault
Troubleshoot Compliance Automation → Auto-remediation from one exact failing target, revision/input and timestamp. Capture ansible-playbook --check --diff <playbook.yml> before mutation, then branch by the first divergent observation: observation is stale or target identity uncertain, do not remediate; preview shows unrelated changes, stop; check mode is unsupported/partial, reduce scope and use provider-specific safe validation; apply succeeds but read-back still drifts, inspect competing controller/manual changes; drift disappears but service fails, rollback/escalate. Typical failure signatures include remediating stale data, policy targeting the wrong object, broad unintended diff, provider side effect omitted from preview, concurrent reconciler race, repeated change loop or configuration convergence with service regression.
Step 4 Failure signatures, dependencies and operational guardrails Narrow the fault
Failure-signature and guardrail reference for Compliance Automation → Auto-remediation: Remediating stale data, policy targeting the wrong object, broad unintended diff, provider side effect omitted from preview, concurrent reconciler race, repeated change loop or configuration convergence with service regression. Operational guardrail: ansible-playbook --check --diff is a prediction with module-specific support; it is not a transactional guarantee and must be followed by controlled application and direct target/workload verification. Dependencies that can mimic the same symptom are observation freshness, policy version, target ownership, check/dry-run fidelity, credentials, concurrency locks, rollback data and the service dependencies affected by the change.
- Auto-fix only well-understood, low-risk settings.
- Log every automatic change.
- Use alert-only mode for risky settings.
- Auto-remediation playbooks for failed controls — fixing
- Safe-to-fix list — scope
- Remediation logs — evidence
ReferenceHow it works1 section · depth on demand
How it works
Compliance Automation → Auto-remediation owns drift detection, policy classification, remediation preview, approval/safety gate, bounded target application, read-back and recurrence monitoring. Execution mechanics: Auto-remediation should trigger only from a trusted fresh observation, translate one approved policy violation into a deterministic desired delta, preview it where the provider supports that safely, apply to a bounded scope, read state back and watch for immediate re-drift. Keep adjacent dependencies separate: observation freshness, policy version, target ownership, check/dry-run fidelity, credentials, concurrency locks, rollback data and the service dependencies affected by the change. The mapped read surface ansible-playbook --check --diff <playbook.yml> exposes Ansible's predicted change set and diff for modules that support check mode.
ReferenceImportant terms & boundaries1 section · depth on demand
Method
Auto-remediation fixes detected problems automatically — reverting drift, restarting services, applying missing baseline settings. Because it acts without a human, it needs strict safeguards.
1. Start with detection only and review findings for false positives.
2. Select low-risk, well-understood fixes for automation.
3. Add guards: maximum targets per run, change windows, exclusions.
4. Verify after each fix and stop if verification fails.
5. Log every action and notify owners.
6. Review regularly and expand gradually.
| Safe to auto-remediate | Needs approval |
|---|---|
| Re-enable logging setting | Shutting down interfaces |
| Restart a crashed agent | Changing routing |
| Remove forbidden local account | Blocking users broadly |
Repeated remediation of the same item means something keeps changing it — find and fix that source.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in Compliance Automation > Auto-remediation. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://www.openpolicyagent.org/docs/latest/ · confidence 94%