Ansible Synchronize With Wildcard


Answer :

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" 

Comments

Popular posts from this blog

Are Regular VACUUM ANALYZE Still Recommended Under 9.1?

Can Feynman Diagrams Be Used To Represent Any Perturbation Theory?