Krikri::RoleBoolKeywords
include_role:/import_role:'s own boolean keywords (public:,
allow_duplicates:, rolespec_validate:, rescuable:) are converted to a Python
bool by ansible-core 2.19.11 BEFORE the role itself is
resolved, and a value that is not a bool at all fails the task with a
three-link cause chain:
[ERROR]: Task failed: Error processing keyword 'public':
The value 'snhvdg' could not be converted to 'bool'.
Task failed.
Origin: pb.yml:4:5
...
<<< caused by >>>
Error processing keyword 'public'.
Origin: pb.yml:5:81
...
<<< caused by >>>
The value 'snhvdg' could not be converted to 'bool'.
Origin: pb.yml:5:81
The same conversion failure on a STATIC import_role: aborts the whole
run at playbook-load time instead (rc=4, no play banner, and the
chain without its "Task failed." link) - same split Ansible has between
IncludeRole.load and the dynamic task body. What is convertible is
ansible's own BOOLEANS set (case-insensitive y/yes/on/1/true/t and
n/no/off/0/false/f), plus 0/1 and 0.0/1.0 as numbers, plus None;
every other number, list and mapping is refused (live-verified vs
2.19.11: public: 2 fails, public: 1 does not).
Lives in its own file because both the parser (which needs it at parse time, for import_role:) and the task executor (which needs it at run time, for include_role:) use it, and neither can require the other's file without a cycle.
Constants
Ansible's own conversion order - public is converted before
allow_duplicates, which is converted before rolespec_validate, which
is converted before rescuable
(live-verified vs 2.19.11 for the first three, vs 2.21.6 for
rescuable: a task with both rolespec_validate and rescuable
unconvertible reports rolespec_validate).
Class methods
The first keyword (in Ansible's conversion order) whose value is not convertible to a bool, or nil when they are all fine (or are templated values, which real resolves before this conversion runs - see the file comment).