Interview Prep/Ansible/Playbook Design, Handlers and Idempotency

You want to keep a backup of every config file Ansible replaces.

BeginnerScenarioPlaybook Design, Handlers and Idempotency
Answer

Situation read → Safety net for rollbacks.

What I'd do →

- ansible.builtin.template:
    src: app.conf.j2
    dest: /etc/app/app.conf
    backup: true

Why → The module saves a timestamped copy next to the original, and returns backup_file.

Interview tip → Backups pile up; long-term, rely on Git for the source and keep backups for emergencies.

All Ansible questions Roadmap: Ansible

More on Playbook Design, Handlers and Idempotency