-
Notifications
You must be signed in to change notification settings - Fork 8
/
deploy.yaml
30 lines (24 loc) · 938 Bytes
/
deploy.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
---
- hosts: servers
vars_files:
- vars.yml
gather_facts: false
sudo: true
sudo_user: myproject
tasks:
- name: Pull sources from the repository.
git: repo={{ project_repo }} dest={{ project_root }}/code/ version={{ branch }}
only_if: "$vm == 0"
notify:
- restart web frontend
- name: Upload configuration.
copy: src=webapp_settings/local_settings.{{ nickname }}.py dest={{ project_root }}/code/webapp/local_settings.py
only_if: "$vm == 0"
- name: Upgrade the virtualenv.
pip: requirements={{ project_root }}/code/requirements.txt virtualenv={{ project_root }}/env/
- name: Sync Django database.
shell: {{ project_root }}/env/bin/python {{ project_root }}/code/webapp/manage.py syncdb --migrate --noinput
- name: Generate Django media.
shell: {{ project_root }}/env/bin/python {{ project_root }}/code/webapp/manage.py generatemedia
handlers:
- include: handlers.yml