Interview Prep/Ansible/YAML, Syntax and Jinja2 Errors

File permissions come out as `--w----r-T` after setting `mode: 644`

IntermediateTroubleshootingYAML, Syntax and Jinja2 Errors
Answer

Likely causes → An unquoted 644 is the decimal integer 644, which is octal 1204: sticky bit, owner write, other read. An unquoted 0644 happens to work because YAML 1.1 reads it as octal, but that is fragile.

Diagnose → stat -c '%a %A' /etc/app.conf prints 1204 --w----r-T.

Fix →

mode: "0644"       # or the symbolic form: "u=rw,g=r,o=r"

Prevent → Always quote modes. ansible-lint rules risky-octal and risky-file-permissions catch this.

All Ansible questions Roadmap: Ansible

More on YAML, Syntax and Jinja2 Errors