supysonic/tasks/main.yml
vincent 8de75415be
All checks were successful
continuous-integration/drone/push Build is passing
linting
2021-11-14 11:40:31 +01:00

84 lines
2.2 KiB
YAML

---
# tasks file for supysonic
- name: select specific Database tasks
include_tasks: "database_{{ supysonic_DB_typ }}.yml"
- name: create folder in var
file:
path: "/var/{{ supysonic_name }}" # required. Path to the file being managed.
state: directory
become: true
- name: ensure venv folder exist
file:
name: "{{ venv_location }}"
state: directory
mode: 0777
become: true
notify:
- restart supysonic service
- name: create venv
pip:
name: "git+{{ supysonic_rep }}"
virtualenv: "{{ venv_locatio }}{{ supysonic_venv_nam }}"
virtualenv_command: /usr/bin/python -m venv
state: "{{ 'forcereinstall' if supysonic_force_site_update ==true else 'present'}}"
become: true
- name: install sql client
pip:
virtualenv: "{{ venv_locatio }}{{ supysonic_venv_nam }}" # not required. An optional path to a I(virtualenv) directory to install into. It cannot be specified together with the 'executable' parameter (added in 2.1). If the virtualenv does not exist, it will be created before installing packages. The optional virtualenv_site_packages, virtualenv_command, and virtualenv_python options affect the creation of the virtualenv.
name:
- pymysql
- psycopg2
become: yes
- name: apply config template
template:
dest: "/etc/supysonic"
src: "supysonic.j2"
become: true
notify:
- restart supysonic service
- restart daemon service
- name: install gunicorn
become: true
pip:
virtualenv: "{{ venv_locatio }}{{ supysonic_venv_nam }}"
name: gunicorn
- name: apply systemd service template
template:
dest: "/etc/systemd/system/supysonic-server.service"
src: "systemd/supysonic-server.service.j2"
become: true
notify:
- Reload systemd
- restart supysonic service
- name: apply systemd daemon template
template:
dest: "/etc/systemd/system/{{ supysonic_nam }}-daemon.service"
src: "systemd/supysonic-daemon.service.j2"
become: true
notify:
- Reload systemd
- restart daemon service
- name: enable daemon service
systemd:
name: "{{ supysonic_nam }}-daemon.service"
enabled: true
state: started
become: yes
- name: enable supysonic service
systemd:
name: "supysonic-server.service"
enabled: true
state: started
become: true