Closed mminklet closed 7 years ago
Some users have reported this problem in the past as you can see in some old issues
Adding a .rsync-filter file to the repo does the trick in a much easier way
Ah good idea. Thanks
I couldn't get this to work. Added .rsync-filter file to the project root containing
# Don't rsync these
- /.git
- /.idea
And it still pushes these up to the repo.
Also tried adding as an extra parameter to the rsync command it's still ignored.
@ricardclau unable to get .rsync-filter to work as I expected (probably misunderstanding how it actually works). I would like to exclude the /node_modules directory, however I can't figure out how to do that in .rsync-filter. This is my .rsync-file:
- /node_modules
- /.git
Running Ansible v 2.3.1.0 installed via brew on macOS Sierra. Freshly updated Ansistrano before this post. I'm wondering if I need to enable ansistrano to see .rsync_filter or if it does so out of the box?
My directory structure:
# tree -L 1 . ├── composer.json ├── craft ├── deploy ├── gulpfile.js ├── node_modules ├── package.json ├── public ├── resources ├── templates └── yarn.lock
.rsync-filter is in . and I run deploy as ./ansible-playbook -i deploy/hosts deploy/deploy.yml
According to Ansible docs To exclude files and directories from being synchronized, you may add .rsync-filter files to the source directory.
And the example on Ansible they show to use:
# - /var # exclude any path starting with 'var' starting at the source directory
which I believe is what I've done. I've tried .rsync-filter in . and in ./deploy. No difference
.ansible.cfg contains:
inventory = /usr/local/etc/ansible/hosts
remote_tmp = $HOME/.ansible/tmp
pattern = *
forks = 5
poll_interval = 15
sudo_user = root
transport = smart
module_lang = C
gathering = implicit
sudo_exe = sudo
timeout = 10
ansible_managed = Ansible managed: {file} modified on %Y-%m-%d %H:%M:%S by {uid} on {host}
action_plugins = /usr/share/ansible_plugins/action_plugins
callback_plugins = /usr/share/ansible_plugins/callback_plugins
connection_plugins = /usr/share/ansible_plugins/connection_plugins
lookup_plugins = /usr/share/ansible_plugins/lookup_plugins
vars_plugins = /usr/share/ansible_plugins/vars_plugins
filter_plugins = /usr/share/ansible_plugins/filter_plugins
fact_caching = memory
accelerate_port = 5099
accelerate_timeout = 30
accelerate_connect_timeout = 5.0
accelerate_daemon_timeout = 30
Finally, my deploy.yml file contains:
---
- name: Deploy domain.com
hosts: web
user: myuser
vars:
ansistrano_deploy_from: "/Users/me/Dropbox/Documents/code/mysite"
ansistrano_deploy_to: "/home/me/craftcms"
ansistrano_keep_releases: 5
roles:
- { role: carlosbuenosvinos.ansistrano-deploy }
Apart from this issue, the deploy script is working perfectly.
I haven't used this for a while but if I remember correctly you need to leave out the prepending / as all these paths should be relative
The Ansible docs are often a bit misleanding :(
Using:
- node_modules
- .git
Worked! But only after I deleted the .shared-copy first, or it could have been previous releases, but figure those don't get referenced on additional releases. Not sure if that is the expected behaviour or not.
Yeah, I think this is a bit of a quirk with rsync and the way we use it.
In order to make it work, you need to always sync to the same place (this is why we create the shared-copy folder) and if you change the rsync-filter file after some syncs it won't delete remote files that were already uploaded (it will stop syncing them though as far as I know, similar to what git does with .gitignore)
Sorry, didn't want to open this ticket but I just can't get this working.
So I'm trying to exclude the .git folder, pretty simple stuff I would imagine but I must be doing something wrong as it's not doing it. Playbook below
`
There seems to be an issue with rsync in vagrant
ansistrano_deploy_via: rsync ansistrano_shared_paths:
Each release still contains the .git folder. Tried multiple permutations., even adding it directly to the ansible role.