LOGBOOK

HELP

Quiz Entry - updated: 2026.12.01

Which spellings does Ansible's YAML accept for true and false, and which form should you write?

Besides true/false, YAML 1.1 accepts forms like yes/no, on/off and their capitalised variants; write plain true and false, the only booleans in YAML 1.2.

Boolean spellings: the YAML 1.1 regular expression lists 22 tokens, 11 per value; PyYAML turns 9 of each into booleans and keeps y and n as strings

* 22 spellings in the YAML 1.1 type: 11 for true and 11 for false. *

The YAML 1.1 boolean type lists 22 accepted tokens in total, 11 meaning true and 11 meaning false:

Meaning YAML 1.1 tokens
true y Y yes Yes YES true True TRUE on On ON
false n N no No NO false False FALSE off Off OFF

Ansible's parser (PyYAML) implements all of these except the single letters, so y and n stay strings. Inside a conditional, the table on the Ansible side also lists 1 and 0.

The YAML 1.2 standard keeps only true and false, which is why the community is drifting towards writing only those two. The looser rules cause real bugs: the country code NO (Norway) in a list silently becomes False. Writing true/false and quoting strings that look like booleans avoids the whole class of problem.

Go deeper:

From Quiz: ITIA / Ansible Task Control: Loops, Conditionals, Handlers and Error Handling | Updated: Dec 01, 2026