Sorry for not mentioning it clearly.
I got it fixed.
My issue was , I am taking the values of a.b,c,d dynamically.
so when I am checking for certs[a][b][c][d]['certs'] , it will check until ['certs']., last of the nested dict
My variable is
certs:
host1:
host_type:
host_name:
host_flavor:
certs:
a: 1
b:2
host2:
host_type:
host_name:
host_flavor:
certs:
a: 1
b:2
so, when host3 doesn't have entry, I wanted it to skip the task that I am running
so, when using { certs[a][b][c][d]['certs'] | default([]) }} }
it errors out saying type 'dict' has no value u 'host3'
Instead of checking for { certs[a][b][c][d]['certs'] | default([]) }} }, Now I am doing
{ certs[a] | default({})} --- > which solves my purpose.
when host3 is not present,it will skip the task
Thanks .