# 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: dev 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 }}" ...