Ansible Synchronize With Wildcard
This can be done with ansible's with_lines:
- name: Install services jar
synchronize: src="{{item}}" dest=/opt/company/
with_lines: "find {{ core_repo }}/service-packaging/target/ -name all-services*.jar | grep -v original"
Ansible module synchronize
uses rsync
and supports custom options for rsync
through parameter rsync_opts
(since 1.6) which could be used to filter file.
Example:
- name: sync source code
synchronize:
src: "/path/to/local/src"
dest: "{{lookup('env','HOME')}}/remote/src"
rsync_opts:
- "--include=*.py"
- "--exclude=*.pyc"
- "--delete"