Skip to content

Instantly share code, notes, and snippets.

@ssx
Forked from louim/uploads.yml
Created February 24, 2017 14:14
Show Gist options
  • Save ssx/9e6d577b445f7ea1dfb1b94a37e484c6 to your computer and use it in GitHub Desktop.
Save ssx/9e6d577b445f7ea1dfb1b94a37e484c6 to your computer and use it in GitHub Desktop.
Drop-in playbook for Trellis to push and pull uploads from the server to your local machine.
---
- name: Sync uploads between environments
hosts: web
remote_user: "{{ web_user }}"
vars:
project: "{{ wordpress_sites[site] }}"
project_root: "{{ www_root }}/{{ site }}"
tasks:
# ansible-playbook uploads.yml -i hosts/staging --extra-vars="site=example.com mode=push"
- name: Push uploads
synchronize:
src: "{{ project.local_path }}/web/app/uploads/"
dest: "{{ project_root }}/current/web/app/uploads/"
rsync_opts: --exclude=.DS_Store
when: mode is not defined or mode == "push"
# ansible-playbook uploads.yml -i hosts/staging --extra-vars="site=example.com mode=pull"
- name: Pull uploads
synchronize:
src: "{{ project_root }}/current/web/app/uploads/"
dest: "{{ project.local_path }}/web/app/uploads/"
mode: pull
rsync_opts: --exclude=.DS_Store
when: mode is defined and mode == "pull"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment