android_mt6572_jiabo/lineage/ansible/roles/stats/tasks/main.yml
2025-09-05 16:56:03 +08:00

66 lines
1.4 KiB
YAML

---
- name: Install dependencies
apt:
name: "{{item}}"
state: present
with_items:
- python2.7
- mongodb
- git
- virtualenv
- redis-server
- redis-tools
- name: add user for stats service
user:
name: stats
home: /srv/stats
notify: restart stats
- name: clone stats service
git:
repo: https://github.com/lineageos/tribble-tracker
dest: /srv/stats/app
update: yes
notify: restart stats
- name: Install stats config
copy:
src: files/stats.app.cfg
dest: /srv/stats/app/app.cfg
owner: stats
group: stats
mode: 0600
notify: restart stats
- name: install pip requirements
pip:
requirements: /srv/stats/app/requirements.txt
virtualenv: /srv/stats/venv
become: yes
become_user: stats
notify: restart stats
- name: install extra pip modules
pip:
name: "{{item}}"
virtualenv: /srv/stats/venv
become: yes
become_user: stats
with_items:
- gunicorn
- redis
notify: restart stats
- name: install systemd unit file
copy:
src: files/stats.systemd.unit
dest: /etc/systemd/system/stats.service
notify: restart stats
- name: install nginx config
template:
src: files/nginx.conf.j2
dest: /etc/nginx/sites-enabled/stats
owner: root
group: root
mode: 0644
notify: restart nginx
- meta: flush_handlers
- name: check http status
shell: "curl --fail -I -H 'Host: stats.lineageos.org' https://localhost/ -k"
args:
warn: false