mirror of
https://github.com/davestephens/ansible-nas
synced 2025-01-12 11:38:47 +00:00
add calibremanager
This commit is contained in:
parent
8d1cd19b80
commit
1b87b918c1
10 changed files with 166 additions and 0 deletions
|
@ -21,6 +21,7 @@ If you have a spare domain name you can configure applications to be accessible
|
||||||
* [Bitwarden_rs](https://github.com/dani-garcia/bitwarden_rs) - Self-Hosting port of password manager
|
* [Bitwarden_rs](https://github.com/dani-garcia/bitwarden_rs) - Self-Hosting port of password manager
|
||||||
* [Booksonic](https://booksonic.org/) - The selfhosted audiobook server
|
* [Booksonic](https://booksonic.org/) - The selfhosted audiobook server
|
||||||
* [Calibre-web](https://github.com/janeczku/calibre-web) - Provides a clean interface for browsing, reading and downloading eBooks using an existing Calibre database.
|
* [Calibre-web](https://github.com/janeczku/calibre-web) - Provides a clean interface for browsing, reading and downloading eBooks using an existing Calibre database.
|
||||||
|
* [Calibre](https://calibre-ebook.com) - Calibre is a powerful and easy to use e-book manager.
|
||||||
* [Code Server](https://code.visualstudio.com/) - Powerful IDE from Microsoft accessible through the browser
|
* [Code Server](https://code.visualstudio.com/) - Powerful IDE from Microsoft accessible through the browser
|
||||||
* [Cloud Commander](https://cloudcmd.io/) - A dual panel file manager with integrated web console and text editor
|
* [Cloud Commander](https://cloudcmd.io/) - A dual panel file manager with integrated web console and text editor
|
||||||
* [Cloudflare DDNS](https://hub.docker.com/r/joshuaavalon/cloudflare-ddns/) - automatically update Cloudflare with your IP address
|
* [Cloudflare DDNS](https://hub.docker.com/r/joshuaavalon/cloudflare-ddns/) - automatically update Cloudflare with your IP address
|
||||||
|
|
5
nas.yml
5
nas.yml
|
@ -61,6 +61,11 @@
|
||||||
tags:
|
tags:
|
||||||
- calibre
|
- calibre
|
||||||
|
|
||||||
|
- role: calibremanager
|
||||||
|
tags:
|
||||||
|
- calibremanager
|
||||||
|
when: (calibremanager_enabled | default(False))
|
||||||
|
|
||||||
- role: cloudcmd
|
- role: cloudcmd
|
||||||
tags:
|
tags:
|
||||||
- cloudcmd
|
- cloudcmd
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
volumes:
|
volumes:
|
||||||
- "{{ calibre_data_directory }}/config:/config"
|
- "{{ calibre_data_directory }}/config:/config"
|
||||||
- "{{ calibre_books_root }}:/books"
|
- "{{ calibre_books_root }}:/books"
|
||||||
|
- "{{ calibre_data_directory }}/data:/data"
|
||||||
env:
|
env:
|
||||||
TZ: "{{ ansible_nas_timezone }}"
|
TZ: "{{ ansible_nas_timezone }}"
|
||||||
PUID: "{{ calibre_user_id }}"
|
PUID: "{{ calibre_user_id }}"
|
||||||
|
|
28
roles/calibremanager/defaults/main.yml
Normal file
28
roles/calibremanager/defaults/main.yml
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
---
|
||||||
|
calibremanager_enabled: false
|
||||||
|
calibremanager_available_externally: "false"
|
||||||
|
|
||||||
|
# uid / gid
|
||||||
|
calibremanager_user_id: "1000"
|
||||||
|
calibremanager_group_id: "1000"
|
||||||
|
|
||||||
|
# directories
|
||||||
|
calibremanager_data_directory: "{{ docker_home }}/calibremanager"
|
||||||
|
calibremanager_books_directory: "{{ books_root }}"
|
||||||
|
calibremanager_comics_directory: "{{ comics_root }}"
|
||||||
|
|
||||||
|
# network
|
||||||
|
calibremanager_port: "8093"
|
||||||
|
calibremanager_webserver_port: "8094"
|
||||||
|
calibremanager_hostname: "calibremanager"
|
||||||
|
|
||||||
|
# env
|
||||||
|
calibremanager_password: ""
|
||||||
|
calibremanager_cli_args: ""
|
||||||
|
calibremanager_security_opts: "seccomp=unconfined" # For why this is here, see https://github.com/linuxserver/docker-calibre/issues/102
|
||||||
|
|
||||||
|
# specs
|
||||||
|
calibremanager_memory: 1g
|
||||||
|
|
||||||
|
# docker
|
||||||
|
calibremanager_container_name: calibremanager
|
6
roles/calibremanager/molecule/default/molecule.yml
Normal file
6
roles/calibremanager/molecule/default/molecule.yml
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
---
|
||||||
|
provisioner:
|
||||||
|
inventory:
|
||||||
|
group_vars:
|
||||||
|
all:
|
||||||
|
calibremanager_enabled: true
|
10
roles/calibremanager/molecule/default/side_effect.yml
Normal file
10
roles/calibremanager/molecule/default/side_effect.yml
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
---
|
||||||
|
- name: Stop
|
||||||
|
hosts: all
|
||||||
|
become: true
|
||||||
|
tasks:
|
||||||
|
- name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role"
|
||||||
|
include_role:
|
||||||
|
name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
|
||||||
|
vars:
|
||||||
|
calibremanager_enabled: false
|
18
roles/calibremanager/molecule/default/verify.yml
Normal file
18
roles/calibremanager/molecule/default/verify.yml
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
---
|
||||||
|
- name: Verify
|
||||||
|
hosts: all
|
||||||
|
gather_facts: false
|
||||||
|
tasks:
|
||||||
|
- include_vars:
|
||||||
|
file: ../../defaults/main.yml
|
||||||
|
|
||||||
|
- name: Get container state
|
||||||
|
docker_container_info:
|
||||||
|
name: "{{ calibremanager_container_name }}"
|
||||||
|
register: result
|
||||||
|
|
||||||
|
- name: Check Calibre is running
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.container['State']['Status'] == "running"
|
||||||
|
- result.container['State']['Restarting'] == false
|
18
roles/calibremanager/molecule/default/verify_stopped.yml
Normal file
18
roles/calibremanager/molecule/default/verify_stopped.yml
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
---
|
||||||
|
- name: Verify
|
||||||
|
hosts: all
|
||||||
|
gather_facts: false
|
||||||
|
tasks:
|
||||||
|
- include_vars:
|
||||||
|
file: ../../defaults/main.yml
|
||||||
|
|
||||||
|
- name: Try and stop and remove Calibre
|
||||||
|
docker_container:
|
||||||
|
name: "{{ calibremanager_container_name }}"
|
||||||
|
state: absent
|
||||||
|
register: result
|
||||||
|
|
||||||
|
- name: Check Calibre is stopped
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- not result.changed
|
45
roles/calibremanager/tasks/main.yml
Normal file
45
roles/calibremanager/tasks/main.yml
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
---
|
||||||
|
- name: Create Calibre Directories
|
||||||
|
file:
|
||||||
|
path: "{{ item }}"
|
||||||
|
state: directory
|
||||||
|
mode: 0755
|
||||||
|
with_items:
|
||||||
|
- "{{ calibremanager_data_directory }}/data"
|
||||||
|
|
||||||
|
- name: Calibre Docker Container
|
||||||
|
docker_container:
|
||||||
|
name: "{{ calibremanager_container_name }}"
|
||||||
|
image: linuxserver/calibre
|
||||||
|
pull: true
|
||||||
|
volumes:
|
||||||
|
- "{{ calibremanager_data_directory }}/data:/config:rw"
|
||||||
|
- "{{ calibremanager_books_directory }}:/books:rw"
|
||||||
|
- "{{ calibremanager_comics_directory }}:/comics:rw"
|
||||||
|
ports:
|
||||||
|
- "{{ calibremanager_port }}:8080"
|
||||||
|
- "{{ calibremanager_webserver_port }}:8081"
|
||||||
|
security_opts: "{{ calibremanager_security_opts }}"
|
||||||
|
env:
|
||||||
|
TZ: "{{ ansible_nas_timezone }}"
|
||||||
|
PUID: "{{ calibremanager_user_id }}"
|
||||||
|
PGID: "{{ calibremanager_group_id }}"
|
||||||
|
PASSWORD: "{{ calibremanager_password }}"
|
||||||
|
CLI_ARGS: "{{ calibremanager_cli_args }}"
|
||||||
|
restart_policy: unless-stopped
|
||||||
|
memory: "{{ calibremanager_memory }}"
|
||||||
|
labels:
|
||||||
|
traefik.enable: "{{ calibremanager_available_externally }}"
|
||||||
|
traefik.http.routers.calibre.rule: "Host(`{{ calibremanager_hostname }}.{{ ansible_nas_domain }}`)"
|
||||||
|
traefik.http.routers.calibre.tls.certresolver: "letsencrypt"
|
||||||
|
traefik.http.routers.calibre.tls.domains[0].main: "{{ ansible_nas_domain }}"
|
||||||
|
traefik.http.routers.calibre.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
|
||||||
|
traefik.http.services.calibre.loadbalancer.server.port: "8080"
|
||||||
|
|
||||||
|
- name: Stop Calibre Manager
|
||||||
|
block:
|
||||||
|
- name: Stop Calibre Manager
|
||||||
|
docker_container:
|
||||||
|
name: "{{ calibremanager_container_name }}"
|
||||||
|
state: absent
|
||||||
|
when: calibremanager_enabled is false
|
34
website/docs/applications/media-serving/calibremanager.md
Normal file
34
website/docs/applications/media-serving/calibremanager.md
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
# Calibre
|
||||||
|
|
||||||
|
Homepage: [https://calibre-ebook.com](https://calibre-ebook.com)
|
||||||
|
|
||||||
|
Calibre is a powerful and easy to use e-book manager.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
Set `calibremanager_enabled: true` in your `inventories/<your_inventory>/nas.yml` file.
|
||||||
|
|
||||||
|
## Specific Configuration
|
||||||
|
|
||||||
|
By default, there is no password set for the main gui. Optional `calibremanager_password` will allow setting a password for the user `abc`.
|
||||||
|
|
||||||
|
Optionally, cli start arguments can be passed to calibre using `calibremanager_cli_args`.
|
||||||
|
|
||||||
|
The Calibre webserver must be turned on in the Calibre manager to make it available at the selected port (8094 by default).
|
||||||
|
|
||||||
|
## Use with Calibre-web
|
||||||
|
|
||||||
|
Ansible-NAS has long come with [../calibre](Calibre-web). To allow Calibre-web direct access to the Calibre database, both applications can share a Docker data directory. To do so, include the following in your inventory `nas.yml`:
|
||||||
|
|
||||||
|
```yml
|
||||||
|
calibremanager_data_directory: "{{ docker_home }}/calibre"
|
||||||
|
```
|
||||||
|
|
||||||
|
In this case, the Calibre Database Directory is `/data/Calibre Library`
|
||||||
|
|
||||||
|
## Ports
|
||||||
|
|
||||||
|
```yml
|
||||||
|
calibremanager_port: "8093"
|
||||||
|
calibremanager_webserver_port: "8094"
|
||||||
|
```
|
Loading…
Reference in a new issue