RSS Amplifier

(untitled) · Jun 13, 2014

How to use Ansible to deploy with git

0
Sign in to vote or save

This site does not allow itself to be embedded. You can still read it on the original site — the toolbar below keeps your place in the directory.

Basic Ansible example on deploying with git. vars.yml --- # Update this to your own settings project_name : test project_root : /var/www/test project_repo : git@github.com:miguelmota/test-repo.git handlers.yml : --- - name : restart web server action : command echo 'do something' sudo_user : root deploy.yml : --- - hosts : servers vars_files : - vars.yml gather_facts : false sudo : true sudo_user…

Basic Ansible example on deploying with git.

vars.yml

---
# Update this to your own settings
project_name: test
project_root: /var/www/test
project_repo: git@github.com:miguelmota/test-repo.git

handlers.yml:

---
-  name: restart web server
 action: command echo "do something"
 sudo_user: root

deploy.yml:

---
-  hosts: servers
 vars_files:
 - vars.yml
 gather_facts: false
 sudo: true
 sudo_user: root
 user: root

 tasks:
 - name: Pull sources from the repository.
 git: repo={{project_repo}} dest={{project_root}} version={{branch}}
 notify:
 - restart web server

 handlers:
 - include : handlers.yml

hosts:

Read on miguelmota.com

Comments

Nothing yet. Say the first thing.

    Sign in to join the conversation.