Answer the question
In order to leave comments, you need to log in
How to copy files using Ansible and regular expressions?
I need to copy files from my local machine (from where I run ansible-playbook) to a remote machine. When doing this, copy only the filtered regex.
I tried to copy using with_items - but it is used only on the remote machine
. I used with_fileglob but I can't make friends with it with regular expressions.
Answer the question
In order to leave comments, you need to log in
The task was solved.
Must be added to the block with the search for delegate_to: localhost
- name: Prepare list of packages to copy
find:
paths: "/srv/test_files/"
patterns: '(^((?!.*dbg).)*arm64.*$)'
use_regex: yes
register: file_list
delegate_to: localhost
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question