You have several option:
- name: list directory specific contents
shell: ls *.crt *.cer *.jks *.p12
args:
chdir: /var/certs
register: cert_results
- name: copy list results to new folder
command: cp {{item}} /var/certs/certbkup
args:
chdir: /var/certs
with_items: cert_results.stdout_lines
or just do in in one go
- name: backup files
shell: cp *.crt *.cer *.jks *.p12 /var/certs/certbkup
args:
chdir: /var/certs
If you are copy all the files under /var/certs but not the directories I
also think this would work (not tested).
- name: backup files
synchronize:
src=/var/certs/
dest=/var/certs/certbkup/
recursive=no
--
Kai Stian Olstad