diff options
| author | boom2 <blizzack@blizzack.com> | 2023-11-21 14:11:56 -0500 |
|---|---|---|
| committer | boom2 <blizzack@blizzack.com> | 2023-11-21 14:11:56 -0500 |
| commit | 62766cf1fd721d278e95821e05e6b41f7888eed5 (patch) | |
| tree | 35c0866b9dbc09cdc695435a3aa6aa1424cac1a4 /ansible-practice/09-playbook-remove-files-with-wildcard.yml | |
initial commit
Diffstat (limited to 'ansible-practice/09-playbook-remove-files-with-wildcard.yml')
| -rw-r--r-- | ansible-practice/09-playbook-remove-files-with-wildcard.yml | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/ansible-practice/09-playbook-remove-files-with-wildcard.yml b/ansible-practice/09-playbook-remove-files-with-wildcard.yml new file mode 100644 index 0000000..046d18d --- /dev/null +++ b/ansible-practice/09-playbook-remove-files-with-wildcard.yml @@ -0,0 +1,21 @@ +# remove multiple files using globbing +# https://phoenixnap.com/kb/ansible-create-file +# https://www.freekb.net/Article?id=573 + +--- +- name: "09 - Playing with Ansible - remove a multiple files with globbing" +# hosts: all + hosts: localhost + connection: local + tasks: + - name: Find files with a pattern + find: + paths: "~/" + patterns: "ansible_created_file*" + register: result + - name: Remove multiple files with pattern above + file: + path: "{{ item.path }}" + state: absent + with_items: "{{ result.files }}" +... |
