-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpi-pineapple-django.yaml
50 lines (41 loc) · 1.5 KB
/
pi-pineapple-django.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
- hosts: RASPI_WIFI
remote_user: pi
become: yes
become_method: sudo
become_user: root
tasks:
- name: ensure python3 is at the latest version
apt: name=python3 state=latest
- name: ensure pip3 is at the latest version
apt: name=python3-pip state=latest
- name: ensure setuptools is at the latest version
apt: name=python-setuptools state=latest
- name: ensure setuptools for python3 is at the latest version
pip: name=setuptools executable=pip3
- name: copy django project to raspi
synchronize:
src: pi_pineapple/
dest: /opt/pi_pineapple/
rsync_opts:
- "--exclude=db.sqlite3"
- name: copy requirements.txt to raspi
copy: src=requirements.txt dest=/opt/pi_pineapple/
- name: pip requirements
pip: requirements=/opt/pi_pineapple/requirements.txt executable=pip3
- name: make and run migrations
shell:
cmd: python3 manage.py makemigrations && python3 manage.py migrate
chdir: /opt/pi_pineapple
# - name: create default user
# command: bash -c "python3 manage.py createsu"
# chdir: /opt/pi_pineapple
- name: copy django systemd unit
template: src=pi_pineapple.service dest=/etc/systemd/system/pi_pineapple.service
- name: ensure django is running and enable at boot
service: name=pi_pineapple state=restarted enabled=yes
notify:
- reload systemctl
handlers:
- name: reload systemctl
shell:
cmd: systemctl daemon-reload