Interview Prep/Ansible/Security: Vault, Become and Compliance

You are asked to enforce a CIS baseline on 300 Linux hosts and show drift reports.

AdvancedScenarioSecurity: Vault, Become and Compliance
Answer

Situation read → Compliance as code.

What I'd do →

  1. Use a maintained role (for example, the CIS role set) or write controls as tasks tagged by control ID.
  2. Run in --check --diff mode on a schedule to report drift without changing anything.
  3. Run in enforce mode on a change window.
  4. Export results to a report.
ansible-playbook cis.yml --check --diff --tags level1 | tee drift-$(date +%F).log

Why → Check mode as a scheduled audit turns Ansible into a drift detector.

Interview tip → Be honest that check mode has gaps; pair with OpenSCAP scans.

All Ansible questions Roadmap: Ansible

More on Security: Vault, Become and Compliance