How do you detect and handle configuration drift?
AdvancedProductionProject Structure and Design
Answer
Detect: run the playbooks regularly in --check --diff mode from AWX or CI on a schedule, and report hosts with changed > 0. Because check mode cannot predict everything (command/shell are skipped), pair it with idempotent modules and sanity assertions.
Handle: decide per case whether to enforce (apply the playbook on schedule) or alert and investigate. Enforcing nightly is safe only when playbooks are idempotent and tested. We also lock down interactive access and make changes only through Git, because drift is mostly a process problem rather than a tooling one.
More on Project Structure and Design
What does a production Ansible repository look like?BeginnerMonorepo or separate repos for roles? How do you decide?IntermediateHow do you structure inventories for dev, stage and prod?BeginnerHow do you prevent someone from running a playbook against production by accident?IntermediateWhat does "thin playbooks, fat roles" mean?IntermediateWhat makes a well-designed role?Intermediate