Skip to content

Instantly share code, notes, and snippets.

@tgerla
Created March 26, 2013 20:04
Show Gist options
  • Select an option

  • Save tgerla/5248692 to your computer and use it in GitHub Desktop.

Select an option

Save tgerla/5248692 to your computer and use it in GitHub Desktop.
# a simple playbook to check out a git repository locally and push it to a target
# system using rsync. this avoids the requirement of the git client on the remote
# system, or having the remote system directly access the repo.
---
- hosts: 127.0.0.1
connection: local
tasks:
- name: check out the repository
# might want to use /opt/webapp instead of /tmp -- it's safe to keep the contents
# around on the staging system (the system running ansible) so save a full clone
# every time this runs.
git: repo=http://github.com/bennojoy/mywebapp.git dest=/tmp/webapp version=HEAD
- hosts: webservers
tasks:
- name: copy the repository to the target system
local_action: command rsync -a /tmp/webapp ${ansible_hostname}:/tmp/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment