Search via regex instead of shell glob

This commit is contained in:
Jason Rothstein 2021-07-26 04:13:16 +00:00
parent 0d65e8e562
commit e450b114fc

View File

@ -135,9 +135,9 @@
follow: 'no' follow: 'no'
paths: paths:
- '/var/lib/clamav/' - '/var/lib/clamav/'
patterns:
- '^tmp.([0-9]|[a-f}){10}$' - '^tmp.([0-9]|[a-f}){10}$'
recurse: 'yes' recurse: 'yes'
use_regex: 'yes'
register: 'results' register: 'results'
- name: 'And drop them' - name: 'And drop them'
when: when:
@ -145,7 +145,9 @@
- ensure_clamav is defined - ensure_clamav is defined
- freshclam_retention is defined - freshclam_retention is defined
- freshclam_retention is regex('^[0-9]*[smhdw]$') - freshclam_retention is regex('^[0-9]*[smhdw]$')
- item.path is regex('^/var/lib/clamav/tmp\.([0-9]|[a-f])*$') - results is defined
- results.files is defined
- results.files is iterable
ansible.builtin.file: ansible.builtin.file:
path: '{{ item.path }}' path: '{{ item.path }}'
state: 'absent' state: 'absent'