add supysonic daemon

This commit is contained in:
vincent 2019-11-17 17:12:24 +01:00
parent 5045249644
commit 7fa9bf43c0
5 changed files with 49 additions and 11 deletions

View File

@ -16,3 +16,4 @@ supysonic_db_user: supysonic
supysonic_db_password: supysonic
# Database name
supysonic_db_name: supysonic
supysonic_log_level: INFO

View File

@ -14,3 +14,10 @@
state: restarted # not required. choices: reloaded;restarted;started;stopped. C(started)/C(stopped) are idempotent actions that will not run commands unless necessary. C(restarted) will always bounce the service. C(reloaded) will always reload.
enabled: true
become: yes
- name: restart daemon service
systemd:
name: "{{supysonic_name}}-daemon.service" # not required. Name of the service. When using in a chroot environment you always need to specify the full name i.e. (crond.service).
state: restarted # not required. choices: reloaded;restarted;started;stopped. C(started)/C(stopped) are idempotent actions that will not run commands unless necessary. C(restarted) will always bounce the service. C(reloaded) will always reload.
enabled: true
become: yes

View File

@ -62,13 +62,14 @@
virtualenv: "{{venv_location}}{{supysonic_venv_name}}" # 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
- name: apply systemd service template
- name: apply config template
template:
dest: "/etc/supysonic" # required. Location to render the template to on the remote machine.
src: "supysonic.j2" # required. Path of a Jinja2 formatted template on the Ansible controller. This can be a relative or absolute path.
become: yes
notify:
- restart supysonic service
- restart daemon service
- name: install gunicorn
pip:
@ -85,6 +86,21 @@
- Reload systemd
- restart supysonic service
- name: apply systemd daemon template
template:
dest: "/etc/systemd/system/{{supysonic_name}}-daemon.service" # required. Location to render the template to on the remote machine.
src: "systemd/supysonic-daemon.service.j2" # required. Path of a Jinja2 formatted template on the Ansible controller. This can be a relative or absolute path.
become: yes
notify:
- Reload systemd
- restart daemon service
- name: enable daemon service
systemd:
name: "gunicorn-{{supysonic_name}}.service" # not required. Name of the service. When using in a chroot environment you always need to specify the full name i.e. (crond.service).
enabled: true
become: yes
- name: enable supysonic service
systemd:
name: "gunicorn-{{supysonic_name}}.service" # not required. Name of the service. When using in a chroot environment you always need to specify the full name i.e. (crond.service).

View File

@ -22,7 +22,7 @@ transcode_cache_size = 1024
log_file = /var/supysonic/supysonic.log
; Log level. Possible values: DEBUG, INFO, WARNING, ERROR, CRITICAL. Default: WARNING
log_level = WARNING
log_level = {{supysonic_log_level}}
; Enable the Subsonic REST API. You'll most likely want to keep this on, here for testing purposes. Default: on
;mount_api = on
@ -35,10 +35,11 @@ log_level = WARNING
; This prevents running too many scans when multiple changes are detected for a
; single file over a short time span. Default: 5
wait_delay = 5
socket = /var/run/supysonic.sock
; Optional rotating log file for the scanner daemon. Logs to stderr if empty
log_file = /var/supysonic/supysonic-daemon.log
log_level = INFO
log_level = {{supysonic_log_level}}
[lastfm]
; API and secret key to enable scrobbling. http://www.last.fm/api/accounts

View File

@ -0,0 +1,13 @@
[Unit]
Description=Supysonic Daemon
[Service]
User=root
Group=root
WorkingDirectory={{source_location}}/{{supysonic_name}}
ExecStart={{venv_location}}{{supysonic_venv_name}}/bin/python -m supysonic.daemon
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s TERM $MAINPID
[Install]
WantedBy=multi-user.target