forked from recorder-6-team/django-web-prototype
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplaybook.yml
52 lines (43 loc) · 1.59 KB
/
playbook.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
---
- name: Provisioning playbook
hosts: default
become: yes
tasks:
- name: Install python3 and pip and sql.h for pyodbc installed through requirements.txt
apt:
name:
- unixodbc-dev
- python3
- python3-pip
state: latest
update_cache: yes
- name: Install requiremens
pip:
requirements: /vagrant/requirements.txt
state: latest
- name: Copy configuration
template:
src: recorder/local_settings.example.py
dest: /vagrant/recorder/local_settings.py
vars:
recorder_secret_key: ALARMALARM
recorder_organisation_name: MnhnL
recorder_site_id: TESTDATA
- name: Import MS key
shell: curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
- name: Register MS repo
shell: curl https://packages.microsoft.com/config/ubuntu/20.04/prod.list | sudo tee /etc/apt/sources.list.d/msprod.list
- name: Install tools
apt:
name: mssql-tools
state: latest
update_cache: yes
environment:
ACCEPT_EULA: y
DEBIAN_FRONTEND: noninteractive
- name: Run pre-migrations
shell: '/opt/mssql-tools/bin/sqlcmd -S {{ recorder_database_host }} -d {{ recorder_database_name }} -U {{ recorder_database_user }} -i /vagrant/sqlserver_scripts/USER.sql -P {{ recorder_database_password }}'
- name: Run django migrations
shell: python3 /vagrant/manage.py migrate
- name: Run the application
shell: nohup python3 /vagrant/manage.py runserver 0.0.0.0:8000 </dev/null >/dev/null 2>&1 &