Is there a better way to check if var and var.var both were defined in Ansible playbook? -
i have playbook need give other people want deploy os it. specify variables (set of variables limited, of course) in group/host_vars , might not specify of them. so, example, have set of vars:
var1: var1-1: var1-1-1: ... var1-2: var1-2-1: ... var2: ...
and task:
- copy: src: "{{ var1.var1-1.var1-1-1 }}" dest: /root/
but operator don't specify var1 @ task failed. can workaround problem with
when: var1 defined , var1.var1-1 defined , var1.var1-1.var1-1-1 defined
but looks awful. unfortunately, var1.var1-1.var1-1-1|default({}) not working case , can't use simple variables without encapsulation.
is there better way check if parent object defined?
Comments
Post a Comment