Properly handle items with a false condition

This commit is contained in:
Ruben van Staveren 2024-06-12 13:30:13 +02:00
parent 3b4169bafb
commit 460802d02e
Signed by: ruben
GPG Key ID: 886F6BECD477A93F

View File

@ -37,11 +37,16 @@
debug:
verbosity: 1
msg: |
{% if item.false_condition is not defined -%}
Results of {{ item.cmd | join(' ') }}
{{ item.stdout | default(item.msg | default('No message')) }}
{% else %}
Update of {{ item.item.1 }} skipped due to the following conditional(s) being false
* {{ item.item.2 }} == 'up'
* {{ item.item.3 }} == {{ ansible_distribution_version }}-RELEASE
{% endif -%}
loop: '{{ installupdates_iocage.results }}'
loop_control:
label: '{{ item.cmd | join(" ") }}'
label: 'Update of {{ item.item.1 }}'
when: installupdates_iocage
when: iocage_available.stat.exists