vagrant - Unusable using conditionals -
i have var defined when running vagrant:
is_vagrant: yes
when run other playbook it's not defined var not included.
when in ansible:
when: is_vagrant defined
it works charm when it's defined or not defined.
but when use this:
when: gitclone.changed or is_vagrant defined
it skips task when is_vagrant var included. i'm not sure why?
i've given trusting ansible right thing when comes variable expansions. when ansible tries misguide me messages "you don't need use {{}}
or ""
", still do.
did try:
when: "{{ gitclone.changed or is_vagrant defined }}"
-- edit --
when: "{{ is_vagrant defined or ( gitclone defined , gitclone.changed ) }}"
why have check defined. .changed true or false assume?
if want task 'fail' when variable not defined, don't have check if it's defined. if don't want undefinederror: 'git_output'
error have check.
changed
inside git_output
if git_output
isn't defined git_output.changed
isn't defined extension.