-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy webapp
50 lines (42 loc) · 1.09 KB
/
deploy webapp
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
-
name: Deploy a web app
hosts: all
gather_facts: false
tasks:
- name: Install all dependencies
yum: name= "{{ item }}" state=installed
with_items:
- python
- python-setuptools
- python-dev
- build-essential
- python-pip
- name: Install mysql
yum: name= "{{ item }}" state=installed
with_items:
- mysql-server
- mysql-client
- name: Start mysql
service:
name: mysql
state: started
enabled: yes
- name: Create App database
mysql_db: name=emp_db state=present
- name: Create db user
mysql_user:
name: db_user
password: 12345
priv: '*.*:ALL'
state: present
- name: Install flask dependency
pip:
name: "{{ item }}"
state: present
with_items:
- flask
- flask-mysql
- name: Copy script
copy: src=app.py dest=/opt/app.py
- name: Start webserver
shell: FLASK_APP=/opt/app.py nohup flask run --host=0.0.0.0 &