You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- hosts: localhost
tasks:
- name: List all possibile /etc/hosts candidates
stat:
path: >-
{{item}}
with_items:
- /etc/FOO
- /etc/hosts
register: etc_hosts_candidates
- name: Show only existing
debug:
msg: >
{{ etc_hosts_candidates.results
| selectattr("stat.exists", "equalto", true)
| list }}
Get the first one. Remember map should go before first as it works on lists
and if you put it after, iiuc the item is implicitly converted into its keys which have no "item" attribute
Add this example
Get the first one. Remember map should go before first as it works on lists
and if you put it after, iiuc the item is implicitly converted into its keys which have no "item" attribute
The text was updated successfully, but these errors were encountered: