mirror of
https://github.com/davestephens/ansible-nas
synced 2025-01-12 11:38:47 +00:00
Booksonic starts and stops
This commit is contained in:
parent
b8fcfd30c0
commit
ca36ac0701
4 changed files with 48 additions and 34 deletions
1
nas.yml
1
nas.yml
|
@ -56,7 +56,6 @@
|
||||||
- role: booksonic
|
- role: booksonic
|
||||||
tags:
|
tags:
|
||||||
- booksonic
|
- booksonic
|
||||||
when: (booksonic_enabled | default(False))
|
|
||||||
|
|
||||||
- role: calibre
|
- role: calibre
|
||||||
tags:
|
tags:
|
||||||
|
|
|
@ -17,3 +17,6 @@ booksonic_hostname: "booksonic"
|
||||||
|
|
||||||
# specs
|
# specs
|
||||||
booksonic_memory: 1g
|
booksonic_memory: 1g
|
||||||
|
|
||||||
|
# docker
|
||||||
|
booksonic_container_name: booksonic
|
||||||
|
|
9
roles/booksonic/handlers/main.yml
Normal file
9
roles/booksonic/handlers/main.yml
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
---
|
||||||
|
- name: Stop Booksonic
|
||||||
|
docker_container:
|
||||||
|
name: "{{ booksonic_container_name }}"
|
||||||
|
state: absent
|
||||||
|
when: booksonic_enabled is false
|
||||||
|
listen:
|
||||||
|
- "stop booksonic"
|
||||||
|
- "stop disabled applications"
|
|
@ -1,35 +1,38 @@
|
||||||
---
|
---
|
||||||
- name: Create Booksonic Directories
|
- name: Booksonic
|
||||||
file:
|
block:
|
||||||
path: "{{ item }}"
|
- name: Create Booksonic Directories
|
||||||
state: directory
|
file:
|
||||||
mode: 0755
|
path: "{{ item }}"
|
||||||
with_items:
|
state: directory
|
||||||
- "{{ booksonic_data_directory }}/data"
|
mode: 0755
|
||||||
- "{{ booksonic_data_directory }}/playlists"
|
with_items:
|
||||||
|
- "{{ booksonic_data_directory }}/data"
|
||||||
|
- "{{ booksonic_data_directory }}/playlists"
|
||||||
|
|
||||||
- name: Booksonic Docker Container
|
- name: Booksonic Docker Container
|
||||||
docker_container:
|
docker_container:
|
||||||
name: booksonic
|
name: "{{ booksonic_container_name }}"
|
||||||
image: linuxserver/booksonic-air:latest
|
image: linuxserver/booksonic-air:latest
|
||||||
pull: true
|
pull: true
|
||||||
volumes:
|
volumes:
|
||||||
- "{{ booksonic_data_directory }}/data:/booksonic/data:rw"
|
- "{{ booksonic_data_directory }}/data:/booksonic/data:rw"
|
||||||
- "{{ booksonic_data_directory }}/playlists:/booksonic/playlists:rw"
|
- "{{ booksonic_data_directory }}/playlists:/booksonic/playlists:rw"
|
||||||
- "{{ booksonic_audiobooks_directory }}:/booksonic/audiobooks:rw"
|
- "{{ booksonic_audiobooks_directory }}:/booksonic/audiobooks:rw"
|
||||||
- "{{ booksonic_podcasts_directory }}:/booksonic/podcasts:rw"
|
- "{{ booksonic_podcasts_directory }}:/booksonic/podcasts:rw"
|
||||||
ports:
|
ports:
|
||||||
- "{{ booksonic_port }}:4040"
|
- "{{ booksonic_port }}:4040"
|
||||||
env:
|
env:
|
||||||
TZ: "{{ ansible_nas_timezone }}"
|
TZ: "{{ ansible_nas_timezone }}"
|
||||||
PUID: "{{ booksonic_user_id }}"
|
PUID: "{{ booksonic_user_id }}"
|
||||||
PGID: "{{ booksonic_group_id }}"
|
PGID: "{{ booksonic_group_id }}"
|
||||||
restart_policy: unless-stopped
|
restart_policy: unless-stopped
|
||||||
memory: "{{ booksonic_memory }}"
|
memory: "{{ booksonic_memory }}"
|
||||||
labels:
|
labels:
|
||||||
traefik.enable: "{{ booksonic_available_externally | string }}"
|
traefik.enable: "{{ booksonic_available_externally | string }}"
|
||||||
traefik.http.routers.booksonic.rule: "Host(`{{ booksonic_hostname }}.{{ ansible_nas_domain }}`)"
|
traefik.http.routers.booksonic.rule: "Host(`{{ booksonic_hostname }}.{{ ansible_nas_domain }}`)"
|
||||||
traefik.http.routers.booksonic.tls.certresolver: "letsencrypt"
|
traefik.http.routers.booksonic.tls.certresolver: "letsencrypt"
|
||||||
traefik.http.routers.booksonic.tls.domains[0].main: "{{ ansible_nas_domain }}"
|
traefik.http.routers.booksonic.tls.domains[0].main: "{{ ansible_nas_domain }}"
|
||||||
traefik.http.routers.booksonic.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
|
traefik.http.routers.booksonic.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
|
||||||
traefik.http.services.booksonic.loadbalancer.server.port: "4040"
|
traefik.http.services.booksonic.loadbalancer.server.port: "4040"
|
||||||
|
when: booksonic_enabled is true
|
||||||
|
|
Loading…
Reference in a new issue