diff --git a/roles/paperless_ng/defaults/main.yml b/roles/paperless_ng/defaults/main.yml index fb2a8be6..d7ff6d36 100644 --- a/roles/paperless_ng/defaults/main.yml +++ b/roles/paperless_ng/defaults/main.yml @@ -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" diff --git a/roles/paperless_ng/docs/paperless_ng.md b/roles/paperless_ng/docs/paperless_ng.md new file mode 100644 index 00000000..5adabc31 --- /dev/null +++ b/roles/paperless_ng/docs/paperless_ng.md @@ -0,0 +1,23 @@ +# Paperless-ng + +Homepage: + +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//nas.yml` file. + +The paperless-ng web interface can be found at . + +### 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). diff --git a/roles/paperless_ng/docs/trilium.md b/roles/paperless_ng/docs/trilium.md deleted file mode 100644 index 333cf7fb..00000000 --- a/roles/paperless_ng/docs/trilium.md +++ /dev/null @@ -1,11 +0,0 @@ -# Trilium - -Homepage: - -A hierarchical note taking application with focus on building large personal knowledge bases. - -## Usage - -Set `trilium_enabled: true` in your `inventories//nas.yml` file. - -Trilium web interface can be found at . diff --git a/roles/paperless_ng/molecule/default/molecule.yml b/roles/paperless_ng/molecule/default/molecule.yml index 91b053f0..e009fab6 100644 --- a/roles/paperless_ng/molecule/default/molecule.yml +++ b/roles/paperless_ng/molecule/default/molecule.yml @@ -3,4 +3,4 @@ provisioner: inventory: group_vars: all: - trilium_enabled: true + paperless_ng_enabled: true diff --git a/roles/paperless_ng/molecule/default/side_effect.yml b/roles/paperless_ng/molecule/default/side_effect.yml index 92e03151..5a9810b7 100644 --- a/roles/paperless_ng/molecule/default/side_effect.yml +++ b/roles/paperless_ng/molecule/default/side_effect.yml @@ -7,4 +7,4 @@ ansible.builtin.include_role: name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}" vars: - trilium_enabled: false + paperless_ng_enabled: false diff --git a/roles/paperless_ng/molecule/default/verify.yml b/roles/paperless_ng/molecule/default/verify.yml index 9080137d..500fae12 100644 --- a/roles/paperless_ng/molecule/default/verify.yml +++ b/roles/paperless_ng/molecule/default/verify.yml @@ -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 diff --git a/roles/paperless_ng/molecule/default/verify_stopped.yml b/roles/paperless_ng/molecule/default/verify_stopped.yml index e82fff95..24f87932 100644 --- a/roles/paperless_ng/molecule/default/verify_stopped.yml +++ b/roles/paperless_ng/molecule/default/verify_stopped.yml @@ -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 diff --git a/roles/paperless_ng/tasks/main.yml b/roles/paperless_ng/tasks/main.yml index fe3cedb6..bca48846 100644 --- a/roles/paperless_ng/tasks/main.yml +++ b/roles/paperless_ng/tasks/main.yml @@ -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 diff --git a/roles/piwigo/defaults/main.yml b/roles/piwigo/defaults/main.yml index 82a9add6..efdcfd7c 100644 --- a/roles/piwigo/defaults/main.yml +++ b/roles/piwigo/defaults/main.yml @@ -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" diff --git a/roles/piwigo/docs/piwigo.md b/roles/piwigo/docs/piwigo.md new file mode 100644 index 00000000..f691ba27 --- /dev/null +++ b/roles/piwigo/docs/piwigo.md @@ -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//nas.yml` file. + +If you want to access Piwigo externally, set `piwigo_available_externally: true` in your `inventories//nas.yml` file. + +The Piwigo web interface can be found at . + +## Specific Configuration + +Optional configurations: + +- Set `piwigo_mysql_user` in `inventories//group_vars/nas.yml` before installing Piwigo, this defaults to "piwigo". +- Set `piwigo_mysql_password` in `inventories//group_vars/nas.yml` before installing Piwigo, this defaults to "piwigo". +- Set `piwigo_mysql_root_password` in `inventories//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_` diff --git a/roles/piwigo/docs/trilium.md b/roles/piwigo/docs/trilium.md deleted file mode 100644 index 333cf7fb..00000000 --- a/roles/piwigo/docs/trilium.md +++ /dev/null @@ -1,11 +0,0 @@ -# Trilium - -Homepage: - -A hierarchical note taking application with focus on building large personal knowledge bases. - -## Usage - -Set `trilium_enabled: true` in your `inventories//nas.yml` file. - -Trilium web interface can be found at . diff --git a/roles/piwigo/molecule/default/molecule.yml b/roles/piwigo/molecule/default/molecule.yml index 91b053f0..33909c29 100644 --- a/roles/piwigo/molecule/default/molecule.yml +++ b/roles/piwigo/molecule/default/molecule.yml @@ -3,4 +3,4 @@ provisioner: inventory: group_vars: all: - trilium_enabled: true + piwigo_enabled: true diff --git a/roles/piwigo/molecule/default/side_effect.yml b/roles/piwigo/molecule/default/side_effect.yml index 92e03151..b100aed6 100644 --- a/roles/piwigo/molecule/default/side_effect.yml +++ b/roles/piwigo/molecule/default/side_effect.yml @@ -7,4 +7,4 @@ ansible.builtin.include_role: name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}" vars: - trilium_enabled: false + piwigo_enabled: false diff --git a/roles/piwigo/molecule/default/verify.yml b/roles/piwigo/molecule/default/verify.yml index 9080137d..32343069 100644 --- a/roles/piwigo/molecule/default/verify.yml +++ b/roles/piwigo/molecule/default/verify.yml @@ -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 diff --git a/roles/piwigo/molecule/default/verify_stopped.yml b/roles/piwigo/molecule/default/verify_stopped.yml index e82fff95..750ae3d4 100644 --- a/roles/piwigo/molecule/default/verify_stopped.yml +++ b/roles/piwigo/molecule/default/verify_stopped.yml @@ -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 diff --git a/roles/piwigo/tasks/main.yml b/roles/piwigo/tasks/main.yml index 67c02ea9..9c5dd0de 100644 --- a/roles/piwigo/tasks/main.yml +++ b/roles/piwigo/tasks/main.yml @@ -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 diff --git a/roles/plex/defaults/main.yml b/roles/plex/defaults/main.yml index 220ebb6b..a53135ca 100644 --- a/roles/plex/defaults/main.yml +++ b/roles/plex/defaults/main.yml @@ -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" diff --git a/roles/plex/docs/plex.md b/roles/plex/docs/plex.md new file mode 100644 index 00000000..be9a37e0 --- /dev/null +++ b/roles/plex/docs/plex.md @@ -0,0 +1,16 @@ +# Plex + +Homepage: + +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//nas.yml` file. + +The Plex web interface can be found at . + +## 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. diff --git a/roles/plex/docs/trilium.md b/roles/plex/docs/trilium.md deleted file mode 100644 index 333cf7fb..00000000 --- a/roles/plex/docs/trilium.md +++ /dev/null @@ -1,11 +0,0 @@ -# Trilium - -Homepage: - -A hierarchical note taking application with focus on building large personal knowledge bases. - -## Usage - -Set `trilium_enabled: true` in your `inventories//nas.yml` file. - -Trilium web interface can be found at . diff --git a/roles/plex/molecule/default/molecule.yml b/roles/plex/molecule/default/molecule.yml index 91b053f0..4611624d 100644 --- a/roles/plex/molecule/default/molecule.yml +++ b/roles/plex/molecule/default/molecule.yml @@ -3,4 +3,4 @@ provisioner: inventory: group_vars: all: - trilium_enabled: true + plex_enabled: true diff --git a/roles/plex/molecule/default/side_effect.yml b/roles/plex/molecule/default/side_effect.yml index 92e03151..597eb871 100644 --- a/roles/plex/molecule/default/side_effect.yml +++ b/roles/plex/molecule/default/side_effect.yml @@ -7,4 +7,4 @@ ansible.builtin.include_role: name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}" vars: - trilium_enabled: false + plex_enabled: false diff --git a/roles/plex/molecule/default/verify.yml b/roles/plex/molecule/default/verify.yml index 9080137d..d971c288 100644 --- a/roles/plex/molecule/default/verify.yml +++ b/roles/plex/molecule/default/verify.yml @@ -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" diff --git a/roles/plex/molecule/default/verify_stopped.yml b/roles/plex/molecule/default/verify_stopped.yml index e82fff95..37859b3c 100644 --- a/roles/plex/molecule/default/verify_stopped.yml +++ b/roles/plex/molecule/default/verify_stopped.yml @@ -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 diff --git a/roles/plex/tasks/main.yml b/roles/plex/tasks/main.yml index b22961a8..7597d22c 100644 --- a/roles/plex/tasks/main.yml +++ b/roles/plex/tasks/main.yml @@ -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 diff --git a/roles/portainer/defaults/main.yml b/roles/portainer/defaults/main.yml index 7c3443d6..e5dd8138 100644 --- a/roles/portainer/defaults/main.yml +++ b/roles/portainer/defaults/main.yml @@ -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 diff --git a/roles/portainer/docs/portainer.md b/roles/portainer/docs/portainer.md new file mode 100644 index 00000000..d9d9fe77 --- /dev/null +++ b/roles/portainer/docs/portainer.md @@ -0,0 +1,9 @@ +# Portainer + +Homepage: + +## Usage + +Set `portainer_enabled: true` in your `inventories//nas.yml` file. + +The Portainer web interface can be found at . diff --git a/roles/portainer/docs/trilium.md b/roles/portainer/docs/trilium.md deleted file mode 100644 index 333cf7fb..00000000 --- a/roles/portainer/docs/trilium.md +++ /dev/null @@ -1,11 +0,0 @@ -# Trilium - -Homepage: - -A hierarchical note taking application with focus on building large personal knowledge bases. - -## Usage - -Set `trilium_enabled: true` in your `inventories//nas.yml` file. - -Trilium web interface can be found at . diff --git a/roles/portainer/molecule/default/molecule.yml b/roles/portainer/molecule/default/molecule.yml index 91b053f0..9c88debc 100644 --- a/roles/portainer/molecule/default/molecule.yml +++ b/roles/portainer/molecule/default/molecule.yml @@ -3,4 +3,4 @@ provisioner: inventory: group_vars: all: - trilium_enabled: true + portainer_enabled: true diff --git a/roles/portainer/molecule/default/side_effect.yml b/roles/portainer/molecule/default/side_effect.yml index 92e03151..db6a99fb 100644 --- a/roles/portainer/molecule/default/side_effect.yml +++ b/roles/portainer/molecule/default/side_effect.yml @@ -7,4 +7,4 @@ ansible.builtin.include_role: name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}" vars: - trilium_enabled: false + portainer_enabled: false diff --git a/roles/portainer/molecule/default/verify.yml b/roles/portainer/molecule/default/verify.yml index 9080137d..a53be8a4 100644 --- a/roles/portainer/molecule/default/verify.yml +++ b/roles/portainer/molecule/default/verify.yml @@ -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" diff --git a/roles/portainer/molecule/default/verify_stopped.yml b/roles/portainer/molecule/default/verify_stopped.yml index e82fff95..5add0bf7 100644 --- a/roles/portainer/molecule/default/verify_stopped.yml +++ b/roles/portainer/molecule/default/verify_stopped.yml @@ -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 diff --git a/roles/portainer/tasks/main.yml b/roles/portainer/tasks/main.yml index d49f1e78..665f8483 100644 --- a/roles/portainer/tasks/main.yml +++ b/roles/portainer/tasks/main.yml @@ -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