Re: [ansible-project] simplify always the same conditionals - evaluate contents of a string in conditionals (changed_when, failed_when, ...)

2020-06-11 Thread Michael K.
Hi Brian, thanks for your advice. I've added the variable as host var ansible_fortios_default_changed_when: "{{ 'meta' in r and r['meta']['status'] == 'success' and r['meta']['revision_changed'] == true }}" ansible_fortios_default_failed_when: "{{ 'meta' not in r or r['meta']['status'] ==

Re: [ansible-project] simplify always the same conditionals - evaluate contents of a string in conditionals (changed_when, failed_when, ...)

2020-06-10 Thread Brian Coca
instead of set_fact (which forces static evaluation BEFORE the task, use `vars:` which is lazy evaluation (on us). Also you are using templating in the wrong places. failed_when: my_failed_when|bool vars: my_failed_when: "{{'meta' not in r or r['meta']['status'] == 'error'}}" --

[ansible-project] simplify always the same conditionals - evaluate contents of a string in conditionals (changed_when, failed_when, ...)

2020-06-09 Thread Michael K.
Hi there, while working with fortinet.fortios I've engineered that the modules need some help to track the changed and failed status. So I've added the following parameters to each module called: - name: "{{ device }}{{ vdom }} configure static route" fortios_router_static: vdom: "{{ vdom