## Expected Behavior If the parent key `non_existent_key` does not exist, the print statement should print the default value `string`. For details (and some workarounds found by the community), see: - https://stackoverflow.com/questions/19614027/jinja2-template-variable-if-none-object-set-a-default-value - https://github.com/ansible/ansible/issues/30944 ## Actual Behavior If the parent key does not exist, it throws an error. ## Template Code ```jinja {{ mydict.non_existent_key.var | default("string") }} ```
Expected Behavior
If the parent key
non_existent_keydoes not exist, the print statement should print the default valuestring.For details (and some workarounds found by the community), see:
Actual Behavior
If the parent key does not exist, it throws an error.
Template Code
{{ mydict.non_existent_key.var | default("string") }}