module

Krikri::ExtraVarsParser

-e / --extra-vars, Ansible's highest-precedence variable scope. Every accepted form below was checked against a ansible-core 2.19.4 before being implemented here:

-e key=value one or more whitespace-separated k=v pairs; the value is ALWAYS a string, so -e num=5 yields "5" (type_debug: str), not the integer 5 -e '{"k": 1}' a JSON object - real types preserved, so num stays an int here -e @vars.yml load a YAML (or JSON) file repeated -e later occurrences win on a key collision

Precedence relative to everything else is handled by the executor, which applies the parsed result last - see TaskExecutor's @extra_vars.

Class methods

parse(occurrences : Array(String)) : Hash(String, JSON::Any)

Parses CLI occurrences in order, merging later over earlier.

Source
parse_with_origins(occurrences : Array(String)) : Tuple(Hash(String, JSON::Any), Hash(String, VarOrigin))

Same merge, plus the ORIGINS of the values that came from an -e @file occurrence (see VarOrigin): real points a name-template error inside such a value at the FILE's own value position (live-verified vs 2.19.11: an -e @extra.yml entry evf: "{{ undef_evf }}" reports Origin: .../extra.yml:1:6 with the usual excerpt+caret, NOT Origin: <CLI option '-e'>). k=v and inline-JSON occurrences have no file origin; a key they (re)define ERASES any file origin an earlier occurrence gave it, matching the value that actually wins.

Source

Nested types