-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
deploy.yml
executable file
·46 lines (37 loc) · 1.32 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
#!/usr/bin/env ansible-playbook
- name: Deploy
hosts: all
gather_facts: false
vars:
env: prod
prefix: /var/www/ch2rss-{{ env }}
tasks:
- name: flake8
local_action: shell which flake8 && flake8 --config ./.flake8 *.py
- name: create virtualenv
command: python3.12 -m venv {{ prefix }}
args:
creates: "{{ prefix }}/bin"
tags: full
- name: upload {{ playbook_dir }} to {{ prefix }}
synchronize: src={{ playbook_dir }}/ dest={{ prefix }} archive=no recursive=yes perms=yes
- name: install deps
command: bin/pip install -r requirements.txt
args:
chdir: "{{ prefix }}"
tags: full
- name: install supervisor config
file: state=link src={{ prefix }}/supervisor.conf dest=/etc/supervisor/conf.d/ch2rss.conf
tags: full
- name: set stats.json permissions
file: path={{ prefix }}/public/stats.json state=touch owner=www-data group=www-data mode=0644
tags: full
- name: check if crontab file exists locally
local_action: stat path=crontab
register: crontab_file
- name: install crontab
file: state=link src={{ prefix }}/crontab dest=/etc/cron.d/ch2rss modification_time=now
when: crontab_file.stat.exists
tags: full
- name: restart process
supervisorctl: name=ch2rss state=restarted