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

Running `--diff` on a template leaks a secret into the CI log.

IntermediateScenarioSecurity: Vault, Become and Compliance
Answer

Situation read → Diff output reveals file content.

What I'd do → Disable diff on that task.

- ansible.builtin.template:
    src: db.env.j2
    dest: /etc/app/db.env
    mode: "0600"
  diff: false
  no_log: true

Why → The diff: false task keyword suppresses diff output for the task.

Interview tip → Both keywords exist: diff shows content differences, no_log hides module args and result.

All Ansible questions Roadmap: Ansible

More on Security: Vault, Become and Compliance