And if those variables are not set, the playbook complains and exits.
Now I discovered that setting this in ‘playbooks/group_vars/all’
k8s:
host:
port:
The playbook starts, and I can include a role that eventually sets real values to ‘k8s.host’ and ‘k8s.port’… Then once that’s done, all ‘k8s’ modules succesfully have their defaults set !
Cool. So I apparently resolving the variables used in ‘module_defaults’ is done in a later stage.
For me , this resolves my problem. I’m just curious if this is supposed to work this way, and will
sustain later versions.
All variables are ‘lazy evaluation’, but we need to evaluate the module_defaults before we know if we have to use the particular one, so the variables do need to be defined, even if not specifically used, but when actually used it should have gotten reevaluated to the ‘current context’, which hopefully matches what you need to do (we might have fixed this in 2.19, but I need to check).