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 →
- Use a maintained role (for example, the CIS role set) or write controls as tasks tagged by control ID.
- Run in
--check --diffmode on a schedule to report drift without changing anything. - Run in enforce mode on a change window.
- 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.
More on Security: Vault, Become and Compliance
Database passwords are sitting in plain text in `group_vars`. How do you fix it?BeginnerYou need separate vault passwords for staging and prod.IntermediateHow do you change the vault password for all encrypted files?IntermediateA CI pipeline needs the vault password without storing it in the repo.IntermediateYou want to see the value inside an encrypted file without writing a decrypted copy to disk.BeginnerOnly one value in a vars file is secret and you want it in the same file as plain values.Beginner