supysonic/tasks/main.yml

84 lines
2.2 KiB
YAML
Raw Normal View History

2019-05-13 17:00:10 +00:00
---
2020-01-13 19:04:49 +00:00
# tasks file for supysonic
2019-05-13 17:00:10 +00:00
2020-09-06 20:16:56 +00:00
- name: select specific Database tasks
2021-11-14 10:40:31 +00:00
include_tasks: "database_{{ supysonic_DB_typ }}.yml"
2019-05-13 17:00:10 +00:00
- name: create folder in var
file:
2021-11-14 10:40:31 +00:00
path: "/var/{{ supysonic_name }}" # required. Path to the file being managed.
state: directory
become: true
2019-05-13 17:00:10 +00:00
- name: ensure venv folder exist
file:
2021-11-14 10:40:31 +00:00
name: "{{ venv_location }}"
2019-05-13 17:00:10 +00:00
state: directory
mode: 0777
2021-11-14 10:40:31 +00:00
become: true
2021-11-14 10:32:06 +00:00
notify:
- restart supysonic service
2019-05-13 17:00:10 +00:00
- name: create venv
pip:
2021-11-14 10:40:31 +00:00
name: "git+{{ supysonic_rep }}"
virtualenv: "{{ venv_locatio }}{{ supysonic_venv_nam }}"
2019-05-13 17:00:10 +00:00
virtualenv_command: /usr/bin/python -m venv
2021-11-14 10:40:31 +00:00
state: "{{ 'forcereinstall' if supysonic_force_site_update ==true else 'present'}}"
become: true
2019-05-13 17:00:10 +00:00
- name: install sql client
pip:
2021-11-14 10:40:31 +00:00
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.
2021-07-17 08:25:41 +00:00
name:
- pymysql
2020-09-06 20:16:56 +00:00
- psycopg2
2021-07-17 08:25:41 +00:00
become: yes
2021-11-14 10:32:06 +00:00
2019-11-17 16:12:24 +00:00
- name: apply config template
2019-05-13 17:00:10 +00:00
template:
2021-11-14 10:40:31 +00:00
dest: "/etc/supysonic"
src: "supysonic.j2"
become: true
2019-05-13 17:00:10 +00:00
notify:
2019-11-17 16:12:24 +00:00
- restart supysonic service
- restart daemon service
2019-05-13 17:00:10 +00:00
- name: install gunicorn
2021-11-14 10:40:31 +00:00
become: true
2019-05-13 17:00:10 +00:00
pip:
2021-11-14 10:40:31 +00:00
virtualenv: "{{ venv_locatio }}{{ supysonic_venv_nam }}"
name: gunicorn
2019-05-13 17:00:10 +00:00
- name: apply systemd service template
template:
2021-11-14 10:40:31 +00:00
dest: "/etc/systemd/system/supysonic-server.service"
src: "systemd/supysonic-server.service.j2"
become: true
2019-05-13 17:00:10 +00:00
notify:
2019-11-17 16:12:24 +00:00
- Reload systemd
- restart supysonic service
- name: apply systemd daemon template
template:
2021-11-14 10:40:31 +00:00
dest: "/etc/systemd/system/{{ supysonic_nam }}-daemon.service"
src: "systemd/supysonic-daemon.service.j2"
become: true
2019-11-17 16:12:24 +00:00
notify:
- Reload systemd
- restart daemon service
2021-07-17 08:25:41 +00:00
- name: enable daemon service
2019-11-17 16:12:24 +00:00
systemd:
2021-11-14 10:40:31 +00:00
name: "{{ supysonic_nam }}-daemon.service"
2019-11-17 16:12:24 +00:00
enabled: true
2020-01-13 19:04:49 +00:00
state: started
2021-07-17 08:25:41 +00:00
become: yes
2019-05-14 08:24:24 +00:00
2021-07-17 08:25:41 +00:00
- name: enable supysonic service
2019-05-14 08:24:24 +00:00
systemd:
2021-11-14 10:40:31 +00:00
name: "supysonic-server.service"
2019-05-14 08:24:24 +00:00
enabled: true
2020-01-13 19:04:49 +00:00
state: started
2021-11-14 10:40:31 +00:00
become: true