Skip to content

Commit

Permalink
Improvements to how we use rsync for source
Browse files Browse the repository at this point in the history
When rsyncing local source to server (when source_is_local is true,
mainly when using vagrant), exclude deployment dir, and use the
same ssh as ansible.
dpoirier committed Jan 17, 2019
1 parent 10a237a commit 52f8ca5
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 3 additions & 2 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -6,8 +6,9 @@ Changes
v 0.9.n+1 on Month Day, Year
----------------------------

* TBD

* When rsyncing local source to server (when source_is_local is true,
mainly when using vagrant), exclude deployment dir, and use the
same ssh as ansible.

v 0.9.20 on Dec 27, 2018
------------------------
6 changes: 6 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -99,18 +99,24 @@

# NB! The trailing '/' on the 'src' parameter is significant, do not remove!
# (see the docs: http://docs.ansible.com/ansible/synchronize_module.html)
# Exclude 'deployment' dir since we don't need it on the server and it seems
# to be prone to circular symlinks that break rsync.
# Use whatever ssh executable ansible is using.
- name: sync source from local directory
synchronize:
dest: "{{ source_dir }}"
src: "{{ local_project_dir }}/"
delete: yes
rsync_path: "sudo rsync" # Use sudo on the remote system
recursive: true
set_remote_user: no
rsync_opts:
- "--exclude=.env"
- "--exclude=.git"
- "--exclude=node_modules"
- "--exclude=deployment"
- "--exclude=*.pyc"
- "--rsh={{ ansible_ssh_executable }}"
become: no # stops synchronize trying to sudo locally
when: source_is_local

0 comments on commit 52f8ca5

Please sign in to comment.