Skip to content

Instantly share code, notes, and snippets.

@davenaylor
Forked from louim/uploads.yml
Last active August 29, 2015 14:24
Show Gist options
  • Save davenaylor/b41398a7f468837b10fc to your computer and use it in GitHub Desktop.
Save davenaylor/b41398a7f468837b10fc to your computer and use it in GitHub Desktop.
---
- 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=pull"
- name: Push uploads
synchronize:
src: "../site/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=push"
- name: Pull uploads
synchronize:
src: "{{ project_root }}/current/web/app/uploads/"
dest: "../site/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