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

73 lines
1.7 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 download service
user:
name: download
home: /srv/download
notify: restart download
- name: clone download service
git:
repo: https://github.com/lineageos/lineageos_updater
dest: /srv/download/app
update: yes
notify: restart download
- name: Install download config
copy:
src: files/download.app.cfg
dest: /srv/download/app/app.cfg
owner: download
group: download
mode: 0600
notify: restart download
- name: install pip requirements
pip:
requirements: /srv/download/app/requirements.txt
virtualenv: /srv/download/venv
become: yes
become_user: download
notify: restart download
- name: install extra pip modules
pip:
name: "{{item}}"
virtualenv: /srv/download/venv
become: yes
become_user: download
with_items:
- gunicorn
- redis
notify: restart download
- name: install systemd unit file
copy:
src: files/download.systemd.unit
dest: /etc/systemd/system/download.service
notify: restart download
- name: install nginx config
template:
src: files/nginx.conf.j2
dest: /etc/nginx/sites-enabled/download
owner: root
group: root
mode: 0644
notify: restart nginx
- meta: flush_handlers
- name: check http status
shell: "curl --fail -I -H 'Host: download.lineageos.org' https://localhost/ -k"
args:
warn: false
- name: import devices
shell: FLASK_APP=updater.app /srv/download/venv/bin/flask import_devices
args:
chdir: /srv/download/app/
become: yes
become_user: download