-
Notifications
You must be signed in to change notification settings - Fork 3
/
play.yml
60 lines (55 loc) · 2.07 KB
/
play.yml
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
---
- name: test play as root
hosts: all
remote_user: hubot
sudo: yes
tasks:
- apt: name=python-virtualenv state=latest
- apt: name=rabbitmq-server state=latest
- apt: name=ffmpeg state=latest
- apt: name=python-pip state=latest
- service: name=rabbitmq-server state=started
- name: test play as project user
hosts: all
remote_user: hubot
sudo_user: jigglypuff
sudo: yes
vars:
project_dir: /home/jigglypuff
tasks:
- command: date +%d-%m-%y--%H-%M
register: datetime
- file: name=previous state=absent
- git: repo=https://github.com/brodul/jigglypuff.git dest={{ project_dir }}/gitcache
- shell: "cp -r {{ project_dir }}/gitcache {{ project_dir }}/{{ datetime.stdout }} "
- shell: "rm -rf {{ project_dir }}/{{ datetime.stdout }}/nixpkgs "
- shell: "mv {{ project_dir }}/current {{ project_dir }}/previous || :"
- command: virtualenv . chdir={{ project_dir }}/{{datetime.stdout}}
- command: bin/pip install setuptools --upgrade chdir={{ project_dir }}/{{datetime.stdout}}
- command: bin/pip install . chdir={{ project_dir }}/{{datetime.stdout}}
- file: path={{ project_dir }}/{{datetime.stdout}}/jigglypuff/media state=directory
- shell: |
sqlite3 file.db <<EOF
.timeout 20000
.backup backup{{ datetime.stdout }}.db
EOF
args:
chdir: "{{ project_dir }}"
result: backup_sh
- shell: "bin/alembic upgrade head"
args:
chdir: "{{ project_dir }}/{{ datetime.stdout }}"
- copy: src=production.ini dest={{ project_dir }}/{{ datetime.stdout }}/production.ini
- file: state=link src={{ project_dir }}/{{ datetime.stdout }} dest={{ project_dir }}/current
- name: test play as root
hosts: all
remote_user: hubot
sudo: yes
vars:
project_dir: /home/jigglypuff
tags:
- last
tasks:
- shell: "mv {{ project_dir }}/current/supervisor/jigglypuff.conf /etc/supervisor/conf.d/jigglypuff.conf || :"
- supervisorctl: name="jigglypuff:jigglypuff-pyramid" state=restarted
- supervisorctl: name="jigglypuff:jigglypuff-worker" state=restarted