i looking way perform task when ansible variable not registers /undefined e.g
-- name: task command: sed -n '5p' "{{app.dirs.includes}}/build.info" | awk '{print $2}' when: (! deployed_revision) , ( !deployed_revision.stdout ) register: deployed_revision
from ansible docs: if required variable has not been set, can skip or fail using jinja2’s defined test. example:
tasks: - shell: echo "i've got '{{ foo }}' , not afraid use it!" when: foo defined - fail: msg="bailing out. play requires 'bar'" when: bar not defined
so in case, when: deployed_revision not defined
should work
Comments
Post a Comment