
Untitled
By: a guest on
Apr 18th, 2012 | syntax:
None | size: 1.57 KB | hits: 14 | expires: Never
$ cat application/django.sls
# Use a macro:
# https://gist.github.com/2149546
# Don't include this in the top.sls, otherwise it will be run every time
# highstate it scalled.
# Do instead:
# salt -G role:appserver state.sls application.django
# salt-call state.sls some.statefile
{% set proj_name = 'reader.fm' %}
{% set github_repo = 'git@github.com:bakodo/audiolyzer.git' %}
{% set timestamp = salt['cmd.run']('date +%Y%m%d%H%M%S') %}
{% set deploy_path = '/var/django/reader.fm/revisions' %}
{% set id_rsa_deploy = '/home/django/.ssh/id_rsa_deploy_audiolyzer' %}
git:
pkg:
- installed
- name: git-core
django:
user:
- present
- fullname: Django
- password:
- shell: /bin/bash
- home: /home/django # TODO: creates home dir owned by root:root
# - groups:
# - django
# - www-data
# create deploy dir
{{ deploy_path }}:
file:
- directory
- makedirs: True
- user: django
# manage ssh deploy key
{{ id_rsa_deploy }}:
file:
- managed
- source: salt://application/files/id_rsa_deploy_audiolyzer
- makedirs: True
- user: django
- group: django
- mode: 600
# lower our standards
# TODO: do this on ~/.ssh/config
echo " StrictHostKeyChecking no" >> /etc/ssh/ssh_config:
cmd:
- run
# clone git repo
git clone git@github:bakodo/audiolyzer.git {{ deploy_path }}/{{ timestamp }}:
cmd:
- run
- user: django
# set up virtualenv