-
-
Save akatch/5b5164064999082dbb1a6a36ce5237d0 to your computer and use it in GitHub Desktop.
Ansible cannot iterate on a dict & check the results (changed_when/failed_when/&c).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- hosts: localhost | |
vars: | |
places: | |
alpha: /home | |
beta: /srv | |
delta: /opt | |
gamma: /etc | |
epsiolon: /code | |
tasks: | |
- stat: | |
path: '{{ places[item] }}' | |
with_items: '{{ places.keys() }}' | |
register: places_stats | |
- debug: | |
msg: 'it doesnt exist' | |
when: not item.stat.exists | |
with_items: '{{ places_stats.results }}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment