-
-
Save radamhu/2d57372b4216ae3fec5e78d2bc18978d to your computer and use it in GitHub Desktop.
ansible: get files from directory - only names without path
This file contains hidden or 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
- name: "get files from dir" | |
find: | |
paths: "/some/dir/foo" | |
register: found_files | |
- name: print file names without path | |
debug: | |
msg: "{{ found_files['files'] | map(attribute='path') | map('regex_replace','^.*/(.*)$','\\1') | list }}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment