-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy.yml
57 lines (49 loc) · 1.19 KB
/
deploy.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
---
- name: Configure web server
hosts: webserver
become: true
tasks:
- name: Install dependencies
apt:
name: "{{ item }}"
state: present
with_items:
- python3
- python3-pip
- nginx
- name: Install Python packages
pip:
name: uwsgi
state: present
virtualenv: /path/to/your/virtualenv
- name: Configure Nginx
template:
src: nginx.conf.j2
dest: /etc/nginx/sites-available/your_app.conf
notify:
- Restart Nginx
- name: Enable Nginx site
file:
src: /etc/nginx/sites-available/your_app.conf
dest: /etc/nginx/sites-enabled/your_app.conf
state: link
- name: Disable default Nginx site
file:
src: /etc/nginx/sites-enabled/default
dest: /etc/nginx/sites-enabled/default
state: absent
- name: Deploy application
copy:
src: your_app.py
dest: /path/to/your/app/your_app.py
notify:
- Restart uWSGI
handlers:
- name: Restart Nginx
service:
name: nginx
state: restarted
- name: Restart uWSGI
systemd:
name: uwsgi
state: restarted