Interview Prep/Ansible/YAML, Syntax and Jinja2 Errors

A package pinned as `version: 1.10` installs `1.1`

IntermediateTroubleshootingYAML, Syntax and Jinja2 Errors
Answer

Likely causes → YAML parses 1.10 as the float 1.1. Similar traps: NO (country code Norway) becomes false, on/yes become true, and 012 becomes octal 10.

Diagnose → debug: msg="{{ app_version }} {{ app_version | type_debug }}" prints 1.1 float.

Fix → Quote it: app_version: "1.10". Do the same for version numbers, ZIP codes, phone numbers and any string made of digits.

Prevent → Enable yamllint rule truthy with allowed-values: ['true', 'false'], and quote every value that is not meant to be a number.

All Ansible questions Roadmap: Ansible

More on YAML, Syntax and Jinja2 Errors