mirror of
https://github.com/davestephens/ansible-nas
synced 2025-01-12 11:38:47 +00:00
Another batch: from paperless-ng to portainer
This commit is contained in:
parent
e253f0a5d0
commit
2cddba35c4
32 changed files with 434 additions and 253 deletions
|
@ -1,5 +1,6 @@
|
|||
---
|
||||
paperless_ng_enabled: false
|
||||
paperless_ng_available_externally: false
|
||||
|
||||
# directories
|
||||
paperless_ng_config_directory: "{{ docker_home }}/paperless_ng"
|
||||
|
@ -14,6 +15,7 @@ paperless_ng_consume_directory: "{{ paperless_ng_files_directory }}/consume"
|
|||
# network
|
||||
paperless_ng_port: "16922"
|
||||
paperless_ng_hostname: "paperless_ng"
|
||||
paperless_ng_network_name: "paperless_ng"
|
||||
|
||||
# postgres
|
||||
paperless_ng_postgres_db: "paperless"
|
||||
|
@ -21,10 +23,18 @@ paperless_ng_postgres_user: "paperless"
|
|||
paperless_ng_postgres_password: "paperless"
|
||||
|
||||
# container names
|
||||
paperless_ng_container_network_name: "paperless_ng_network"
|
||||
paperless_ng_container_name_redis: "paperless_ng_redis"
|
||||
paperless_ng_container_name_postgres: "paperless_ng_postgres"
|
||||
paperless_ng_container_name_uiserver: "paperless_ng_uiserver"
|
||||
|
||||
paperless_ng_redis_container_name: "paperless-redis"
|
||||
paperless_ng_redis_image_name: "redis"
|
||||
paperless_ng_redis_image_version: "6.0"
|
||||
|
||||
paperless_ng_db_container_name: "paperless-db"
|
||||
paperless_ng_db_image_name: "postgres"
|
||||
paperless_ng_db_image_version: "13"
|
||||
|
||||
paperless_ng_uiserver_container_name: "paperless-uiserver"
|
||||
paperless_ng_uiserver_image_name: "jonaswinkler/paperless-ng"
|
||||
paperless_ng_uiserver_image_version: "latest"
|
||||
|
||||
# uid/guid
|
||||
paperless_ng_user_id: "1000"
|
||||
|
|
23
roles/paperless_ng/docs/paperless_ng.md
Normal file
23
roles/paperless_ng/docs/paperless_ng.md
Normal file
|
@ -0,0 +1,23 @@
|
|||
# Paperless-ng
|
||||
|
||||
Homepage: <https://github.com/jonaswinkler/paperless-ng>
|
||||
|
||||
Paperless is an application by Daniel Quinn and contributors that indexes your scanned documents and allows you to easily search for documents and store metadata alongside your documents.
|
||||
|
||||
Paperless-ng is a fork of the original project, adding a new interface and many other changes under the hood
|
||||
|
||||
## Usage
|
||||
|
||||
Set `paperless_ng_enabled: true` in your `inventories/<your_inventory>/nas.yml` file.
|
||||
|
||||
The paperless-ng web interface can be found at <http://ansible_nas_host_or_ip:16922>.
|
||||
|
||||
### Create the superuser
|
||||
|
||||
To be able to login, you will need a super user. To create it, execute the following command:
|
||||
|
||||
```bash
|
||||
docker exec -it paperless_ng_uiserver python manage.py createsuperuser
|
||||
```
|
||||
|
||||
This will prompt you to set a username, an optional e-mail address and finally a password (at least 8 characters).
|
|
@ -1,11 +0,0 @@
|
|||
# Trilium
|
||||
|
||||
Homepage: <https://github.com/zadam/trilium>
|
||||
|
||||
A hierarchical note taking application with focus on building large personal knowledge bases.
|
||||
|
||||
## Usage
|
||||
|
||||
Set `trilium_enabled: true` in your `inventories/<your_inventory>/nas.yml` file.
|
||||
|
||||
Trilium web interface can be found at <http://ansible_nas_host_or_ip:8105>.
|
|
@ -3,4 +3,4 @@ provisioner:
|
|||
inventory:
|
||||
group_vars:
|
||||
all:
|
||||
trilium_enabled: true
|
||||
paperless_ng_enabled: true
|
||||
|
|
|
@ -7,4 +7,4 @@
|
|||
ansible.builtin.include_role:
|
||||
name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
|
||||
vars:
|
||||
trilium_enabled: false
|
||||
paperless_ng_enabled: false
|
||||
|
|
|
@ -7,13 +7,27 @@
|
|||
ansible.builtin.include_vars:
|
||||
file: ../../defaults/main.yml
|
||||
|
||||
- name: Get trilium container state
|
||||
- name: Get paperless_ng redis container state
|
||||
community.docker.docker_container:
|
||||
name: "{{ trilium_container_name }}"
|
||||
name: "{{ paperless_ng_redis_container_name }}"
|
||||
register: result_redis
|
||||
|
||||
- name: Get paperless_ng db container state
|
||||
community.docker.docker_container:
|
||||
name: "{{ paperless_ng_db_container_name }}"
|
||||
register: result_db
|
||||
|
||||
- name: Get paperless_ng container state
|
||||
community.docker.docker_container:
|
||||
name: "{{ paperless_ng_uiserver_container_name }}"
|
||||
register: result
|
||||
|
||||
- name: Check if trilium containers are running
|
||||
- name: Check if paperless_ng containers are running
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- result_redis.container['State']['Status'] == "running"
|
||||
- result_redis.container['State']['Restarting'] == false
|
||||
- result_db.container['State']['Status'] == "running"
|
||||
- result_db.container['State']['Restarting'] == false
|
||||
- result.container['State']['Status'] == "running"
|
||||
- result.container['State']['Restarting'] == false
|
||||
|
|
|
@ -7,13 +7,27 @@
|
|||
ansible.builtin.include_vars:
|
||||
file: ../../defaults/main.yml
|
||||
|
||||
- name: Try and stop and remove trilium
|
||||
- name: Try and stop and remove paperless_ng
|
||||
community.docker.docker_container:
|
||||
name: "{{ trilium_container_name }}"
|
||||
name: "{{ paperless_ng_uiserver_container_name }}"
|
||||
state: absent
|
||||
register: result
|
||||
|
||||
- name: Check if trilium is stopped
|
||||
- name: Try and stop and remove paperless_ng db
|
||||
community.docker.docker_container:
|
||||
name: "{{ paperless_ng_db_container_name }}"
|
||||
state: absent
|
||||
register: result_db
|
||||
|
||||
- name: Try and stop and remove paperless_ng redis
|
||||
community.docker.docker_container:
|
||||
name: "{{ paperless_ng_redis_container_name }}"
|
||||
state: absent
|
||||
register: result_redis
|
||||
|
||||
- name: Check if paperless_ng is stopped
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- not result.changed
|
||||
- not result_db.changed
|
||||
- not result_redis.changed
|
||||
|
|
|
@ -1,67 +1,96 @@
|
|||
---
|
||||
- name: Create paperless_ng directories
|
||||
file:
|
||||
path: "{{ item }}"
|
||||
state: directory
|
||||
with_items:
|
||||
- "{{ paperless_ng_config_directory }}"
|
||||
- "{{ paperless_ng_files_directory }}"
|
||||
- "{{ paperless_ng_postgres_directory }}"
|
||||
- "{{ paperless_ng_data_directory }}"
|
||||
- "{{ paperless_ng_export_directory }}"
|
||||
- "{{ paperless_ng_media_directory }}"
|
||||
- "{{ paperless_ng_consume_directory }}"
|
||||
- name: Start paperless_ng
|
||||
block:
|
||||
- name: Create paperless_ng directories
|
||||
ansible.builtin.file:
|
||||
path: "{{ item }}"
|
||||
state: directory
|
||||
with_items:
|
||||
- "{{ paperless_ng_config_directory }}"
|
||||
- "{{ paperless_ng_files_directory }}"
|
||||
- "{{ paperless_ng_postgres_directory }}"
|
||||
- "{{ paperless_ng_data_directory }}"
|
||||
- "{{ paperless_ng_export_directory }}"
|
||||
- "{{ paperless_ng_media_directory }}"
|
||||
- "{{ paperless_ng_consume_directory }}"
|
||||
|
||||
- name: Create paperless_ng network
|
||||
community.docker.docker_network:
|
||||
name: "{{ paperless_ng_network_name }}"
|
||||
|
||||
- name: Create paperless_ng network
|
||||
docker_network:
|
||||
name: "{{ paperless_ng_container_network_name }}"
|
||||
- name: Create paperless_ng redis broker
|
||||
community.docker.docker_container:
|
||||
container_default_behavior: no_defaults
|
||||
name: "{{ paperless_ng_redis_container_name }}"
|
||||
image: "{{ paperless_ng_redis_image_name }}:{{ paperless_ng_redis_image_version }}"
|
||||
pull: true
|
||||
restart_policy: unless-stopped
|
||||
memory: "{{ paperless_ng_redis_memory }}"
|
||||
networks:
|
||||
- name: "{{ paperless_ng_network_name }}"
|
||||
network_mode: "{{ paperless_ng_network_name }}"
|
||||
|
||||
- name: Create paperless_ng redis broker
|
||||
docker_container:
|
||||
name: "{{ paperless_ng_container_name_redis }}"
|
||||
image: redis:6.0
|
||||
pull: true
|
||||
restart_policy: unless-stopped
|
||||
memory: "{{ paperless_ng_redis_memory }}"
|
||||
networks:
|
||||
- name: "{{ paperless_ng_container_network_name }}"
|
||||
- name: Create paperless_ng postgres Docker Container
|
||||
community.docker.docker_container:
|
||||
name: "{{ paperless_ng_db_container_name }}"
|
||||
image: "{{ paperless_ng_db_image_name }}:{{ paperless_ng_db_image_version }}"
|
||||
pull: true
|
||||
volumes:
|
||||
- "{{ paperless_ng_postgres_directory }}:/var/lib/postgresql/data"
|
||||
env:
|
||||
POSTGRES_DB: "{{ paperless_ng_postgres_db }}"
|
||||
POSTGRES_USER: "{{ paperless_ng_postgres_user }}"
|
||||
POSTGRES_PASSWORD: "{{ paperless_ng_postgres_password }}"
|
||||
restart_policy: unless-stopped
|
||||
memory: "{{ paperless_ng_postgres_memory }}"
|
||||
networks:
|
||||
- name: "{{ paperless_ng_network_name }}"
|
||||
network_mode: "{{ paperless_ng_network_name }}"
|
||||
|
||||
- name: Create paperless_ng postgres Docker Container
|
||||
docker_container:
|
||||
name: "{{ paperless_ng_container_name_postgres }}"
|
||||
image: postgres:13
|
||||
pull: true
|
||||
volumes:
|
||||
- "{{ paperless_ng_postgres_directory }}:/var/lib/postgresql/data"
|
||||
env:
|
||||
POSTGRES_DB: "{{ paperless_ng_postgres_db }}"
|
||||
POSTGRES_USER: "{{ paperless_ng_postgres_user }}"
|
||||
POSTGRES_PASSWORD: "{{ paperless_ng_postgres_password }}"
|
||||
restart_policy: unless-stopped
|
||||
memory: "{{ paperless_ng_postgres_memory }}"
|
||||
networks:
|
||||
- name: "{{ paperless_ng_container_network_name }}"
|
||||
- name: Create paperless_ng UI Docker Container
|
||||
community.docker.docker_container:
|
||||
name: "{{ paperless_ng_uiserver_container_name }}"
|
||||
image: "{{ paperless_ng_uiserver_image_name }}:{{ paperless_ng_uiserver_image_version }}"
|
||||
pull: true
|
||||
volumes:
|
||||
- "{{ paperless_ng_data_directory }}:/usr/src/paperless/data"
|
||||
- "{{ paperless_ng_media_directory }}:/usr/src/paperless/media"
|
||||
- "{{ paperless_ng_export_directory }}:/usr/src/paperless/export"
|
||||
- "{{ paperless_ng_consume_directory }}:/usr/src/paperless/consume"
|
||||
ports:
|
||||
- "{{ paperless_ng_port }}:8000"
|
||||
env:
|
||||
PAPERLESS_REDIS: "redis://{{ paperless_ng_redis_container_name | string }}:6379"
|
||||
PAPERLESS_DBHOST: "{{ paperless_ng_db_container_name | string }}"
|
||||
USERMAP_UID: "{{ paperless_ng_user_id }}"
|
||||
USERMAP_GID: "{{ paperless_ng_group_id }}"
|
||||
PAPERLESS_OCR_LANGUAGES: "{{ paperless_ng_languages }}"
|
||||
restart_policy: unless-stopped
|
||||
memory: "{{ paperless_ng_ui_memory }}"
|
||||
networks:
|
||||
- name: "{{ paperless_ng_network_name }}"
|
||||
network_mode: "{{ paperless_ng_network_name }}"
|
||||
labels:
|
||||
traefik.enable: "{{ paperless_ng_available_externally | string }}"
|
||||
traefik.http.routers.paperless_ng.rule: "Host(`{{ paperless_ng_hostname }}.{{ ansible_nas_domain }}`)"
|
||||
traefik.http.routers.paperless_ng.tls.certresolver: "letsencrypt"
|
||||
traefik.http.routers.paperless_ng.tls.domains[0].main: "{{ ansible_nas_domain }}"
|
||||
traefik.http.routers.paperless_ng.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
|
||||
traefik.http.services.paperless_ng.loadbalancer.server.port: "8080"
|
||||
when: paperless_ng_enabled is true
|
||||
|
||||
- name: Create paperless_ng UI Docker Container
|
||||
docker_container:
|
||||
name: "{{ paperless_ng_container_name_uiserver }}"
|
||||
image: jonaswinkler/paperless-ng:latest
|
||||
pull: true
|
||||
volumes:
|
||||
- "{{ paperless_ng_data_directory }}:/usr/src/paperless/data"
|
||||
- "{{ paperless_ng_media_directory }}:/usr/src/paperless/media"
|
||||
- "{{ paperless_ng_export_directory }}:/usr/src/paperless/export"
|
||||
- "{{ paperless_ng_consume_directory }}:/usr/src/paperless/consume"
|
||||
ports:
|
||||
- "{{ paperless_ng_port }}:8000"
|
||||
env:
|
||||
PAPERLESS_REDIS: "redis://{{ paperless_ng_container_name_redis | string }}:6379"
|
||||
PAPERLESS_DBHOST: "{{ paperless_ng_container_name_postgres | string }}"
|
||||
USERMAP_UID: "{{ paperless_ng_user_id }}"
|
||||
USERMAP_GID: "{{ paperless_ng_group_id }}"
|
||||
PAPERLESS_OCR_LANGUAGES: "{{ paperless_ng_languages }}"
|
||||
restart_policy: unless-stopped
|
||||
memory: "{{ paperless_ng_ui_memory }}"
|
||||
networks:
|
||||
- name: "{{ paperless_ng_container_network_name }}"
|
||||
- name: Stop paperless_ng
|
||||
block:
|
||||
- name: Stop paperless_ng
|
||||
community.docker.docker_container:
|
||||
name: "{{ paperless_ng_uiserver_container_name }}"
|
||||
state: absent
|
||||
- name: Stop paperless_ng redis
|
||||
community.docker.docker_container:
|
||||
name: "{{ paperless_ng_redis_container_name }}"
|
||||
state: absent
|
||||
- name: Stop paperless_ng db
|
||||
community.docker.docker_container:
|
||||
name: "{{ paperless_ng_db_container_name }}"
|
||||
state: absent
|
||||
when: paperless_ng_enabled is false
|
||||
|
|
|
@ -18,8 +18,17 @@ piwigo_photos_permission: "rw"
|
|||
|
||||
# network
|
||||
piwigo_hostname: "piwigo"
|
||||
piwigo_network_name: "piwigo"
|
||||
piwigo_port: "16923"
|
||||
|
||||
# docker
|
||||
piwigo_db_container_name: "piwigo-db"
|
||||
piwigo_db_image_name: "mysql"
|
||||
piwigo_db_image_version: "5.7"
|
||||
piwigo_container_name: "piwigo"
|
||||
piwigo_image_name: "linuxserver/piwigo"
|
||||
piwigo_image_version: "latest"
|
||||
|
||||
# specs
|
||||
piwigo_memory: "1g"
|
||||
piwigo_mysql_memory: "1g"
|
||||
|
|
28
roles/piwigo/docs/piwigo.md
Normal file
28
roles/piwigo/docs/piwigo.md
Normal file
|
@ -0,0 +1,28 @@
|
|||
# Piwigo
|
||||
|
||||
Homepage: [Piwigo.org](https://piwigo.org)
|
||||
|
||||
Piwigo is open source photo gallery software for the web. Designed for organisations, teams and individuals.
|
||||
|
||||
## Usage
|
||||
|
||||
Set `piwigo_enabled: true` in your `inventories/<your_inventory>/nas.yml` file.
|
||||
|
||||
If you want to access Piwigo externally, set `piwigo_available_externally: true` in your `inventories/<your_inventory>/nas.yml` file.
|
||||
|
||||
The Piwigo web interface can be found at <http://ansible_nas_host_or_ip:16923>.
|
||||
|
||||
## Specific Configuration
|
||||
|
||||
Optional configurations:
|
||||
|
||||
- Set `piwigo_mysql_user` in `inventories/<your_inventory>/group_vars/nas.yml` before installing Piwigo, this defaults to "piwigo".
|
||||
- Set `piwigo_mysql_password` in `inventories/<your_inventory>/group_vars/nas.yml` before installing Piwigo, this defaults to "piwigo".
|
||||
- Set `piwigo_mysql_root_password` in `inventories/<your_inventory>/group_vars/nas.yml` before installing Piwigo, this defaults to "piwigo".
|
||||
|
||||
- On first run you'll need to enter database details:
|
||||
- Host: `db:3306`
|
||||
- Username: the value of piwigo_mysql_user, defaults to "piwigo"
|
||||
- Password: the value of piwigo_password, defaults to "piwigo"
|
||||
- Database Name: `piwigo`
|
||||
- Database tables prefix: should be prefilled with `piwigo_`
|
|
@ -1,11 +0,0 @@
|
|||
# Trilium
|
||||
|
||||
Homepage: <https://github.com/zadam/trilium>
|
||||
|
||||
A hierarchical note taking application with focus on building large personal knowledge bases.
|
||||
|
||||
## Usage
|
||||
|
||||
Set `trilium_enabled: true` in your `inventories/<your_inventory>/nas.yml` file.
|
||||
|
||||
Trilium web interface can be found at <http://ansible_nas_host_or_ip:8105>.
|
|
@ -3,4 +3,4 @@ provisioner:
|
|||
inventory:
|
||||
group_vars:
|
||||
all:
|
||||
trilium_enabled: true
|
||||
piwigo_enabled: true
|
||||
|
|
|
@ -7,4 +7,4 @@
|
|||
ansible.builtin.include_role:
|
||||
name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
|
||||
vars:
|
||||
trilium_enabled: false
|
||||
piwigo_enabled: false
|
||||
|
|
|
@ -7,13 +7,20 @@
|
|||
ansible.builtin.include_vars:
|
||||
file: ../../defaults/main.yml
|
||||
|
||||
- name: Get trilium container state
|
||||
- name: Get piwigo db container state
|
||||
community.docker.docker_container:
|
||||
name: "{{ trilium_container_name }}"
|
||||
name: "{{ piwigo_db_container_name }}"
|
||||
register: result_db
|
||||
|
||||
- name: Get piwigo container state
|
||||
community.docker.docker_container:
|
||||
name: "{{ piwigo_container_name }}"
|
||||
register: result
|
||||
|
||||
- name: Check if trilium containers are running
|
||||
- name: Check if piwigo containers are running
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- result.container['State']['Status'] == "running"
|
||||
- result.container['State']['Restarting'] == false
|
||||
- result_db.container['State']['Status'] == "running"
|
||||
- result_db.container['State']['Restarting'] == false
|
||||
|
|
|
@ -7,13 +7,20 @@
|
|||
ansible.builtin.include_vars:
|
||||
file: ../../defaults/main.yml
|
||||
|
||||
- name: Try and stop and remove trilium
|
||||
- name: Try and stop and remove piwigo
|
||||
community.docker.docker_container:
|
||||
name: "{{ trilium_container_name }}"
|
||||
name: "{{ piwigo_container_name }}"
|
||||
state: absent
|
||||
register: result
|
||||
|
||||
- name: Check if trilium is stopped
|
||||
- name: Try and stop and remove piwigo db
|
||||
community.docker.docker_container:
|
||||
name: "{{ piwigo_db_container_name }}"
|
||||
state: absent
|
||||
register: result_db
|
||||
|
||||
- name: Check if piwigo is stopped
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- not result.changed
|
||||
- not result_db.changed
|
||||
|
|
|
@ -1,51 +1,76 @@
|
|||
---
|
||||
- name: Create Piwigo Directories
|
||||
file:
|
||||
path: "{{ item }}"
|
||||
state: directory
|
||||
with_items:
|
||||
- "{{ piwigo_config_directory }}"
|
||||
- "{{ piwigo_data_directory }}"
|
||||
- "{{ piwigo_photos }}"
|
||||
- name: Start Piwigo
|
||||
block:
|
||||
- name: Create Piwigo Directories
|
||||
ansible.builtin.file:
|
||||
path: "{{ item }}"
|
||||
state: directory
|
||||
with_items:
|
||||
- "{{ piwigo_config_directory }}"
|
||||
- "{{ piwigo_data_directory }}"
|
||||
- "{{ piwigo_photos }}"
|
||||
|
||||
- name: Create MySQL container for Piwigo
|
||||
docker_container:
|
||||
name: piwigo-mysql
|
||||
image: mysql:5.7
|
||||
pull: true
|
||||
volumes:
|
||||
- "{{ piwigo_data_directory }}/mysql:/var/lib/mysql:rw"
|
||||
env:
|
||||
MYSQL_DATABASE: "piwigo"
|
||||
MYSQL_USER: "{{ piwigo_mysql_user }}"
|
||||
MYSQL_PASSWORD: "{{ piwigo_mysql_password }}"
|
||||
MYSQL_ROOT_PASSWORD: "{{ piwigo_mysql_root_password }}"
|
||||
restart_policy: unless-stopped
|
||||
memory: "{{ piwigo_mysql_memory }}"
|
||||
- name: Create Piwigo network
|
||||
community.docker.docker_network:
|
||||
name: "{{ piwigo_network_name }}"
|
||||
|
||||
- name: Piwigo Docker Container
|
||||
docker_container:
|
||||
name: piwigo
|
||||
image: linuxserver/piwigo
|
||||
pull: true
|
||||
volumes:
|
||||
- "{{ piwigo_config_directory }}:/config:rw"
|
||||
- "{{ piwigo_photos }}:/gallery:rw"
|
||||
links:
|
||||
- piwigo-mysql:db
|
||||
ports:
|
||||
- "{{ piwigo_port }}:80"
|
||||
env:
|
||||
TZ: "{{ ansible_nas_timezone }}"
|
||||
PUID: "{{ piwigo_user_id }}"
|
||||
PGID: "{{ piwigo_group_id }}"
|
||||
VERSION: "{{ piwigo_version }}"
|
||||
restart_policy: unless-stopped
|
||||
memory: "{{ piwigo_memory }}"
|
||||
labels:
|
||||
traefik.enable: "{{ piwigo_available_externally | string }}"
|
||||
traefik.http.routers.piwigo.rule: "Host(`{{ piwigo_hostname }}.{{ ansible_nas_domain }}`)"
|
||||
traefik.http.routers.piwigo.tls.certresolver: "letsencrypt"
|
||||
traefik.http.routers.piwigo.tls.domains[0].main: "{{ ansible_nas_domain }}"
|
||||
traefik.http.routers.piwigo.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
|
||||
traefik.http.services.piwigo.loadbalancer.server.port: "80"
|
||||
- name: Create MySQL container for Piwigo
|
||||
community.docker.docker_container:
|
||||
container_default_behavior: no_defaults
|
||||
name: "{{ piwigo_db_container_name }}"
|
||||
image: "{{ piwigo_db_image_name }}:{{ piwigo_db_image_version }}"
|
||||
pull: true
|
||||
volumes:
|
||||
- "{{ piwigo_data_directory }}/mysql:/var/lib/mysql:rw"
|
||||
env:
|
||||
MYSQL_DATABASE: "piwigo"
|
||||
MYSQL_USER: "{{ piwigo_mysql_user }}"
|
||||
MYSQL_PASSWORD: "{{ piwigo_mysql_password }}"
|
||||
MYSQL_ROOT_PASSWORD: "{{ piwigo_mysql_root_password }}"
|
||||
restart_policy: unless-stopped
|
||||
memory: "{{ piwigo_mysql_memory }}"
|
||||
networks:
|
||||
- name: "{{ piwigo_network_name }}"
|
||||
network_mode: "{{ piwigo_network_name }}"
|
||||
|
||||
- name: Piwigo Docker Container
|
||||
community.docker.docker_container:
|
||||
container_default_behavior: no_defaults
|
||||
name: "{{ piwigo_container_name }}"
|
||||
image: "{{ piwigo_image_name }}:{{ piwigo_image_version }}"
|
||||
pull: true
|
||||
volumes:
|
||||
- "{{ piwigo_config_directory }}:/config:rw"
|
||||
- "{{ piwigo_photos }}:/gallery:rw"
|
||||
ports:
|
||||
- "{{ piwigo_port }}:80"
|
||||
env:
|
||||
TZ: "{{ ansible_nas_timezone }}"
|
||||
PUID: "{{ piwigo_user_id }}"
|
||||
PGID: "{{ piwigo_group_id }}"
|
||||
VERSION: "{{ piwigo_version }}"
|
||||
restart_policy: unless-stopped
|
||||
memory: "{{ piwigo_memory }}"
|
||||
networks:
|
||||
- name: "{{ piwigo_network_name }}"
|
||||
network_mode: "{{ piwigo_network_name }}"
|
||||
labels:
|
||||
traefik.enable: "{{ piwigo_available_externally | string }}"
|
||||
traefik.http.routers.piwigo.rule: "Host(`{{ piwigo_hostname }}.{{ ansible_nas_domain }}`)"
|
||||
traefik.http.routers.piwigo.tls.certresolver: "letsencrypt"
|
||||
traefik.http.routers.piwigo.tls.domains[0].main: "{{ ansible_nas_domain }}"
|
||||
traefik.http.routers.piwigo.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
|
||||
traefik.http.services.piwigo.loadbalancer.server.port: "80"
|
||||
when: piwigo_enabled is true
|
||||
|
||||
- name: Stop Piwigo
|
||||
block:
|
||||
- name: Stop Piwigo
|
||||
community.docker.docker_container:
|
||||
name: "{{ piwigo_container_name }}"
|
||||
state: absent
|
||||
- name: Stop Piwigo Db
|
||||
community.docker.docker_container:
|
||||
name: "{{ piwigo_db_container_name }}"
|
||||
state: absent
|
||||
when: piwigo_enabled is false
|
||||
|
|
|
@ -28,6 +28,11 @@ plex_audiobooks_permissions: "rw"
|
|||
# network
|
||||
plex_hostname: "plex"
|
||||
|
||||
# docker
|
||||
plex_container_name: "plex"
|
||||
plex_image_name: "linuxserver/plex"
|
||||
plex_image_version: "latest"
|
||||
|
||||
# specs
|
||||
plex_memory: "2g"
|
||||
|
||||
|
|
16
roles/plex/docs/plex.md
Normal file
16
roles/plex/docs/plex.md
Normal file
|
@ -0,0 +1,16 @@
|
|||
# Plex
|
||||
|
||||
Homepage: <https://www.plex.tv/>
|
||||
|
||||
Plex is a personal media server that also provides access to several external movie, web show, and podcast services. Allows you to stream music too. Apps for many devices, including e.g. chromecast integration.
|
||||
|
||||
## Usage
|
||||
|
||||
Set `plex_enabled: true` in your `inventories/<your_inventory>/nas.yml` file.
|
||||
|
||||
The Plex web interface can be found at <http://ansible_nas_host_or_ip:32400/web/index.html>.
|
||||
|
||||
## Specific Configuration
|
||||
|
||||
You'll need to log in with a plex account, (or possibly claim your server).
|
||||
You'll need to set up your local file store - go to settings > Manage > Libraries, and add your libraries. These are mounted in the root directory by default.
|
|
@ -1,11 +0,0 @@
|
|||
# Trilium
|
||||
|
||||
Homepage: <https://github.com/zadam/trilium>
|
||||
|
||||
A hierarchical note taking application with focus on building large personal knowledge bases.
|
||||
|
||||
## Usage
|
||||
|
||||
Set `trilium_enabled: true` in your `inventories/<your_inventory>/nas.yml` file.
|
||||
|
||||
Trilium web interface can be found at <http://ansible_nas_host_or_ip:8105>.
|
|
@ -3,4 +3,4 @@ provisioner:
|
|||
inventory:
|
||||
group_vars:
|
||||
all:
|
||||
trilium_enabled: true
|
||||
plex_enabled: true
|
||||
|
|
|
@ -7,4 +7,4 @@
|
|||
ansible.builtin.include_role:
|
||||
name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
|
||||
vars:
|
||||
trilium_enabled: false
|
||||
plex_enabled: false
|
||||
|
|
|
@ -7,12 +7,12 @@
|
|||
ansible.builtin.include_vars:
|
||||
file: ../../defaults/main.yml
|
||||
|
||||
- name: Get trilium container state
|
||||
- name: Get plex container state
|
||||
community.docker.docker_container:
|
||||
name: "{{ trilium_container_name }}"
|
||||
name: "{{ plex_container_name }}"
|
||||
register: result
|
||||
|
||||
- name: Check if trilium containers are running
|
||||
- name: Check if plex containers are running
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- result.container['State']['Status'] == "running"
|
||||
|
|
|
@ -7,13 +7,13 @@
|
|||
ansible.builtin.include_vars:
|
||||
file: ../../defaults/main.yml
|
||||
|
||||
- name: Try and stop and remove trilium
|
||||
- name: Try and stop and remove plex
|
||||
community.docker.docker_container:
|
||||
name: "{{ trilium_container_name }}"
|
||||
name: "{{ plex_container_name }}"
|
||||
state: absent
|
||||
register: result
|
||||
|
||||
- name: Check if trilium is stopped
|
||||
- name: Check if plex is stopped
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- not result.changed
|
||||
|
|
|
@ -1,40 +1,52 @@
|
|||
---
|
||||
- name: Create Plex Directories
|
||||
file:
|
||||
path: "{{ item }}"
|
||||
state: directory
|
||||
# mode: 0755
|
||||
with_items:
|
||||
- "{{ plex_config_directory }}"
|
||||
- "{{ plex_logs }}"
|
||||
- name: Start Plex
|
||||
block:
|
||||
- name: Create Plex Directories
|
||||
ansible.builtin.file:
|
||||
path: "{{ item }}"
|
||||
state: directory
|
||||
# mode: 0755
|
||||
with_items:
|
||||
- "{{ plex_config_directory }}"
|
||||
- "{{ plex_logs }}"
|
||||
|
||||
- name: Create Plex Docker Container
|
||||
docker_container:
|
||||
name: plex
|
||||
image: linuxserver/plex
|
||||
pull: true
|
||||
volumes:
|
||||
- "{{ plex_config_directory }}:/config:rw"
|
||||
- "{{ plex_logs }}:/opt/plex/Library/Application Support/Plex Media Server/Logs:rw"
|
||||
- "{{ plex_movies_directory }}:/movies:{{ plex_movies_permissions }}"
|
||||
- "{{ plex_tv_directory }}:/tv:{{ plex_tv_permissions }}"
|
||||
- "{{ plex_photos_directory }}:/photos:{{ plex_photos_permissions }}"
|
||||
- "{{ plex_podcasts_directory }}:/podcasts:{{ plex_podcasts_permissions }}"
|
||||
- "{{ plex_music_directory }}:/music:{{ plex_music_permissions }}"
|
||||
- "{{ plex_audiobooks_directory }}:/audiobooks:{{ plex_audiobooks_permissions }}"
|
||||
network_mode: "host"
|
||||
devices: "{{ plex_devices | default(omit) }}"
|
||||
env:
|
||||
TZ: "{{ ansible_nas_timezone }}"
|
||||
PUID: "{{ plex_user_id }}"
|
||||
PGID: "{{ plex_group_id }}"
|
||||
VERSION: "{{ plex_version }}"
|
||||
restart_policy: unless-stopped
|
||||
memory: "{{ plex_memory }}"
|
||||
labels:
|
||||
traefik.enable: "{{ plex_available_externally | string }}"
|
||||
traefik.http.routers.plex.rule: "Host(`{{ plex_hostname }}.{{ ansible_nas_domain }}`)"
|
||||
traefik.http.routers.plex.tls.certresolver: "letsencrypt"
|
||||
traefik.http.routers.plex.tls.domains[0].main: "{{ ansible_nas_domain }}"
|
||||
traefik.http.routers.plex.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
|
||||
traefik.http.services.plex.loadbalancer.server.port: "32400"
|
||||
- name: Create Plex Docker Container
|
||||
community.docker.docker_container:
|
||||
container_default_behavior: no_defaults
|
||||
name: "{{ plex_container_name }}"
|
||||
image: "{{ plex_image_name }}:{{ plex_image_version }}"
|
||||
pull: true
|
||||
volumes:
|
||||
- "{{ plex_config_directory }}:/config:rw"
|
||||
- "{{ plex_logs }}:/opt/plex/Library/Application Support/Plex Media Server/Logs:rw"
|
||||
- "{{ plex_movies_directory }}:/movies:{{ plex_movies_permissions }}"
|
||||
- "{{ plex_tv_directory }}:/tv:{{ plex_tv_permissions }}"
|
||||
- "{{ plex_photos_directory }}:/photos:{{ plex_photos_permissions }}"
|
||||
- "{{ plex_podcasts_directory }}:/podcasts:{{ plex_podcasts_permissions }}"
|
||||
- "{{ plex_music_directory }}:/music:{{ plex_music_permissions }}"
|
||||
- "{{ plex_audiobooks_directory }}:/audiobooks:{{ plex_audiobooks_permissions }}"
|
||||
network_mode: "host"
|
||||
devices: "{{ plex_devices | default(omit) }}"
|
||||
env:
|
||||
TZ: "{{ ansible_nas_timezone }}"
|
||||
PUID: "{{ plex_user_id }}"
|
||||
PGID: "{{ plex_group_id }}"
|
||||
VERSION: "{{ plex_version }}"
|
||||
restart_policy: unless-stopped
|
||||
memory: "{{ plex_memory }}"
|
||||
labels:
|
||||
traefik.enable: "{{ plex_available_externally | string }}"
|
||||
traefik.http.routers.plex.rule: "Host(`{{ plex_hostname }}.{{ ansible_nas_domain }}`)"
|
||||
traefik.http.routers.plex.tls.certresolver: "letsencrypt"
|
||||
traefik.http.routers.plex.tls.domains[0].main: "{{ ansible_nas_domain }}"
|
||||
traefik.http.routers.plex.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
|
||||
traefik.http.services.plex.loadbalancer.server.port: "32400"
|
||||
when: plex_enabled is true
|
||||
|
||||
- name: Stop Plex
|
||||
block:
|
||||
- name: Stop Plex
|
||||
community.docker.docker_container:
|
||||
name: "{{ plex_container_name }}"
|
||||
state: absent
|
||||
when: plex_enabled is false
|
||||
|
|
|
@ -9,5 +9,10 @@ portainer_data_directory: "{{ docker_home }}/portainer/config"
|
|||
portainer_port: "9000"
|
||||
portainer_hostname: "portainer"
|
||||
|
||||
# docker
|
||||
portainer_container_name: "portainer"
|
||||
portainer_image_name: "portainer/portainer-ce"
|
||||
portainer_image_version: "latest"
|
||||
|
||||
# specs
|
||||
portainer_memory: 1g
|
||||
|
|
9
roles/portainer/docs/portainer.md
Normal file
9
roles/portainer/docs/portainer.md
Normal file
|
@ -0,0 +1,9 @@
|
|||
# Portainer
|
||||
|
||||
Homepage: <https://docs.portainer.io/start/install/server/docker>
|
||||
|
||||
## Usage
|
||||
|
||||
Set `portainer_enabled: true` in your `inventories/<your_inventory>/nas.yml` file.
|
||||
|
||||
The Portainer web interface can be found at <http://ansible_nas_host_or_ip:9000>.
|
|
@ -1,11 +0,0 @@
|
|||
# Trilium
|
||||
|
||||
Homepage: <https://github.com/zadam/trilium>
|
||||
|
||||
A hierarchical note taking application with focus on building large personal knowledge bases.
|
||||
|
||||
## Usage
|
||||
|
||||
Set `trilium_enabled: true` in your `inventories/<your_inventory>/nas.yml` file.
|
||||
|
||||
Trilium web interface can be found at <http://ansible_nas_host_or_ip:8105>.
|
|
@ -3,4 +3,4 @@ provisioner:
|
|||
inventory:
|
||||
group_vars:
|
||||
all:
|
||||
trilium_enabled: true
|
||||
portainer_enabled: true
|
||||
|
|
|
@ -7,4 +7,4 @@
|
|||
ansible.builtin.include_role:
|
||||
name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
|
||||
vars:
|
||||
trilium_enabled: false
|
||||
portainer_enabled: false
|
||||
|
|
|
@ -7,12 +7,12 @@
|
|||
ansible.builtin.include_vars:
|
||||
file: ../../defaults/main.yml
|
||||
|
||||
- name: Get trilium container state
|
||||
- name: Get portainer container state
|
||||
community.docker.docker_container:
|
||||
name: "{{ trilium_container_name }}"
|
||||
name: "{{ portainer_container_name }}"
|
||||
register: result
|
||||
|
||||
- name: Check if trilium containers are running
|
||||
- name: Check if portainer containers are running
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- result.container['State']['Status'] == "running"
|
||||
|
|
|
@ -7,13 +7,13 @@
|
|||
ansible.builtin.include_vars:
|
||||
file: ../../defaults/main.yml
|
||||
|
||||
- name: Try and stop and remove trilium
|
||||
- name: Try and stop and remove portainer
|
||||
community.docker.docker_container:
|
||||
name: "{{ trilium_container_name }}"
|
||||
name: "{{ portainer_container_name }}"
|
||||
state: absent
|
||||
register: result
|
||||
|
||||
- name: Check if trilium is stopped
|
||||
- name: Check if portainer is stopped
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- not result.changed
|
||||
|
|
|
@ -1,28 +1,40 @@
|
|||
---
|
||||
- name: Create Portainer Directories
|
||||
file:
|
||||
path: "{{ item }}"
|
||||
state: directory
|
||||
with_items:
|
||||
- "{{ portainer_data_directory }}"
|
||||
- name: Start Portainer
|
||||
block:
|
||||
- name: Create Portainer Directories
|
||||
ansible.builtin.file:
|
||||
path: "{{ item }}"
|
||||
state: directory
|
||||
with_items:
|
||||
- "{{ portainer_data_directory }}"
|
||||
|
||||
- name: Portainer Docker Container
|
||||
docker_container:
|
||||
name: portainer
|
||||
image: portainer/portainer-ce
|
||||
pull: true
|
||||
volumes:
|
||||
- "{{ portainer_data_directory }}:/data:rw"
|
||||
- "/var/run/docker.sock:/var/run/docker.sock:ro"
|
||||
- "/etc/timezone:/etc/timezone:ro"
|
||||
ports:
|
||||
- "{{ portainer_port }}:9000"
|
||||
restart_policy: unless-stopped
|
||||
memory: "{{ portainer_memory }}"
|
||||
labels:
|
||||
traefik.enable: "{{ portainer_available_externally | string }}"
|
||||
traefik.http.routers.portainer.rule: "Host(`{{ portainer_hostname }}.{{ ansible_nas_domain }}`)"
|
||||
traefik.http.routers.portainer.tls.certresolver: "letsencrypt"
|
||||
traefik.http.routers.portainer.tls.domains[0].main: "{{ ansible_nas_domain }}"
|
||||
traefik.http.routers.portainer.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
|
||||
traefik.http.services.portainer.loadbalancer.server.port: "9000"
|
||||
- name: Portainer Docker Container
|
||||
community.docker.docker_container:
|
||||
container_default_behavior: no_defaults
|
||||
name: "{{ portainer_container_name }}"
|
||||
image: "{{ portainer_image_name }}:{{ portainer_image_version }}"
|
||||
pull: true
|
||||
volumes:
|
||||
- "{{ portainer_data_directory }}:/data:rw"
|
||||
- "/var/run/docker.sock:/var/run/docker.sock:ro"
|
||||
- "/etc/timezone:/etc/timezone:ro"
|
||||
ports:
|
||||
- "{{ portainer_port }}:9000"
|
||||
restart_policy: unless-stopped
|
||||
memory: "{{ portainer_memory }}"
|
||||
labels:
|
||||
traefik.enable: "{{ portainer_available_externally | string }}"
|
||||
traefik.http.routers.portainer.rule: "Host(`{{ portainer_hostname }}.{{ ansible_nas_domain }}`)"
|
||||
traefik.http.routers.portainer.tls.certresolver: "letsencrypt"
|
||||
traefik.http.routers.portainer.tls.domains[0].main: "{{ ansible_nas_domain }}"
|
||||
traefik.http.routers.portainer.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
|
||||
traefik.http.services.portainer.loadbalancer.server.port: "9000"
|
||||
when: portainer_enabled is true
|
||||
|
||||
- name: Stop Portainer
|
||||
block:
|
||||
- name: Stop Portainer
|
||||
community.docker.docker_container:
|
||||
name: "{{ portainer_container_name }}"
|
||||
state: absent
|
||||
when: portainer_enabled is false
|
||||
|
|
Loading…
Reference in a new issue