How to correctly use failed_when with Ansible? -
somehow ended spending more 2 hours trying write simple ansible condition , still failing make pass without warnings.
current version:
failed_when: not (sg_rules.msg | search('(all items completed|security group rule exists)'))
outcome:
fatal: [localhost]: failed! => {"failed": true, "msg": "the conditional check 'not (sg_rules.msg | search('(all items completed|security group rule exists)'))' failed. error was: unexpected templating type error occurred on ({% if not (sg_rules.msg | search('(all items completed|security group rule exists)')) %} true {% else %} false {% endif %}): expected string or buffer"}
if try add quotes and/or jinja2 markers give warning not supposed use jinja2 templates on failed_when
.
what correct (not warnings) way fail tasks when result.msg
not contain 1 of these 2 strings?
Comments
Post a Comment