add supysonic daemon
This commit is contained in:
parent
5045249644
commit
7fa9bf43c0
@ -16,3 +16,4 @@ supysonic_db_user: supysonic
|
||||
supysonic_db_password: supysonic
|
||||
# Database name
|
||||
supysonic_db_name: supysonic
|
||||
supysonic_log_level: INFO
|
@ -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
|
@ -34,7 +34,7 @@
|
||||
become: yes
|
||||
when: location_stat.stat.exists == false or supysonic_force_site_update == true
|
||||
notify:
|
||||
- restart supysonic service
|
||||
- restart supysonic service
|
||||
|
||||
- name: create folder in var
|
||||
file:
|
||||
@ -62,18 +62,19 @@
|
||||
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 supysonic service
|
||||
- restart daemon service
|
||||
|
||||
- name: install gunicorn
|
||||
pip:
|
||||
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: gunicorn # not required. The name of a Python library to install or the url(bzr+,hg+,git+,svn+) of the remote package.,This can be a list (since 2.2) and contain version specifiers (since 2.7).
|
||||
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: gunicorn # not required. The name of a Python library to install or the url(bzr+,hg+,git+,svn+) of the remote package.,This can be a list (since 2.2) and contain version specifiers (since 2.7).
|
||||
|
||||
|
||||
- name: apply systemd service template
|
||||
@ -82,8 +83,23 @@
|
||||
src: "systemd/gunicorn.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 supysonic service
|
||||
- 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:
|
||||
|
@ -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
|
||||
|
13
templates/systemd/supysonic-daemon.service.j2
Normal file
13
templates/systemd/supysonic-daemon.service.j2
Normal 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
|
Loading…
Reference in New Issue
Block a user