Merge paperless role

This commit is contained in:
Marty Oehme 2025-07-15 19:06:54 +02:00
commit b8678bafaa
Signed by: Marty
GPG key ID: 4E535BC19C61886E
13 changed files with 256 additions and 21 deletions

View file

@ -1 +1,4 @@
arrstack_tz: Europe/Berlin
stack_paperless_tz: Europe/Berlin
stack_paperless_ocr_language: deu+eng
stack_paperless_ocr_languages: eng deu frk

View file

@ -1,21 +1,33 @@
$ANSIBLE_VAULT;1.1;AES256
38663563663066323465636561656239653630366234366662333834646137386466353561666139
6263613364316362663863366431663963646461656564360a366332326435386134356233616632
38336136386662383439613830373933633566393836613932653564633938656130663764313961
3532373338643762390a656266386633313037316638306435653830333430656430396138313032
36396562393534366665376562343361386634343262326238393535326431333637653836636436
33313833333565623239306232363935656534643030653961636462383164353230373465393238
64393461343533616536353865623835633065656535316262356365373663616263373637396534
65376266643538663437306237633436656130646430333036336139336231353062626462646135
62326536323362313136356435656364333562363335396237613331626539356139353830353961
33346362653163633063633531663539613630636461323564363633626166353139623030633962
36346331613839373036656231663436653538336336376166373231323037333937643530626161
63323364643736313632323939623833343338393038623939356162653932323265353461303133
32633266616664393739636633356562386430316134353564396664643431623963316136306666
30353566643337306439316132313535303235346430346631303933356465383039663065333163
65323931356165366235383463373738326134303835393738633331336431333563376431313364
38376138386530313764616239653462656133626633613532303937653435663932633039313338
39373965313338623162306632303165323863376430316461336336393630393766383339393334
63353530393164376165313238656137383936616232303130373337326165646231613765356438
39343265666638396631386132373734323037313339633837313961613938386561663733333134
65633338366361646332
61653738666234666537383737636631323931396632353236366639323833363134313066613962
3730306266353834303135653939323561666131333539380a333039663466393061343736653935
38613532346132303730363835373165326361373561666565316332623964316265306131663332
3832373861666138330a646631346262666233383938366234373335383064353662326461656430
35626334356566613731333639663130306133353439666234636137636265313662393730626232
37633430663438666461353735656461623165316134346130663963356464656436313966613739
35373763633936336565666261353631366531323430663461376338373265393235313932363733
66323634656539303732303338376264353935316538373465633462386466383662626534623365
38363362653535386130366462393365393731313034316431373039393331396231663365616435
31373632633264383266623733613530333134643730396336373461633739383436623736613638
39303163373234313534323562643836636337323266366538323932656563376163376162306165
31356165343739373237363734393230356236363339653564326537313336663036313437646636
35313336396361353365323763643861656561633235383732376236333232363565376365386232
32353737373239396436316538323661303164373765343936643736663035323237663935643834
39333238666162363366633938333231313966613430303236636634316136373433323536613833
61386434636464633662383736323630326630313561356335306663333864643462366335643430
34396331633935656632323062613433386234386535613337313561353037356633376664333634
62303063636135343737323331623736303636643735613337633530666134333266323934376631
62386535323834323435373362333662613637383065346335373465343765663836626434666463
39623162313438346239393261613738376435636539623663646461396330326661343633353531
66643362326464376437643732366466633332323837323433343165313735653331346431656136
32376165666437373435646566373036313639316165353639626435333330626530373662333031
37656463333231356465383039336237626235613331376639656665303431353131336436653839
32383031376134643236333231323863633933376238613462623034663262316339353061343635
36336338323331343866643836666530616639313933306536343631303635383862363633373562
65663930306461316363376364663935663566393335396130626436316262643730393133363837
63343334613966343466646366303137663965633639653262316630626436346461643533393135
31303630616662623237313331356263613535323739616162393165336163346161303836653638
30386636663230613731383165333462363033333734326662373961383236386631643139373934
38353732393265656162633739623061333833353138303664633463643234396338643736353132
32313763656165643963373236346364636534333964383131373839616435356631386463646437
39336237356337383930

View file

@ -42,3 +42,8 @@
ansible.builtin.import_role:
name: arr
tags: arr
- name: Set up Paperless stack
ansible.builtin.import_role:
name: paperless
tags: paperless

View file

@ -7,7 +7,7 @@ arrstack_data_dir_create: true
arrstack_puid: 1000
arrstack_pgid: 100
arrstack_tz: NorthAmerica/Chicago
arrstack_tz: America/Chicago
arrstack_umask_set: 022
# arrstack_mb_user: Musicbrainz-user

View file

@ -0,0 +1,38 @@
Role Name
=========
A brief description of the role goes here.
Requirements
------------
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
Role Variables
--------------
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
Dependencies
------------
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
Example Playbook
----------------
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
- hosts: servers
roles:
- { role: username.rolename, x: 42 }
License
-------
BSD
Author Information
------------------
An optional section for the role authors to include contact information, or a website (HTML is not allowed).

View file

@ -0,0 +1,23 @@
---
stack_paperless_env_dir: /opt/stack_paperless
stack_paperless_puid: 1000
stack_paperless_pgid: 100
stack_paperless_serve_dir: /srv
stack_paperless_serve_dir_create: true
stack_paperless_tz: America/Chicago
stack_paperless_ocr_language: eng # default OCR languages
stack_paperless_ocr_languages: eng deu frk # ALL installed languages
stack_paperless_ocr_skip_archive_file: with_text
stack_paperless_enable_update_check: true
# using !unsafe macro to stop ansible from interpolating as variables
stack_paperless_filename_format: !unsafe "{{created_year}}/{{correspondent}}/{{created}}_{{title}}"
stack_paperless_dbname: ppldbname
stack_paperless_dbuser: ppldbuser
stack_paperless_dbpass: ppldbpass
stack_paperless_secret_key: super-secret-random-key
stack_paperless_admin_user: AnAdminUserName
stack_paperless_admin_password: AnAdminPassword

View file

@ -0,0 +1,2 @@
---
# handlers file for paperless

View file

@ -0,0 +1,34 @@
galaxy_info:
author: your name
description: your role description
company: your company (optional)
# If the issue tracker for your role is not on github, uncomment the
# next line and provide a value
# issue_tracker_url: http://example.com/issue/tracker
# Choose a valid license ID from https://spdx.org - some suggested licenses:
# - BSD-3-Clause (default)
# - MIT
# - GPL-2.0-or-later
# - GPL-3.0-only
# - Apache-2.0
# - CC-BY-4.0
license: license (GPL-2.0-or-later, MIT, etc)
min_ansible_version: 2.1
# If this a Container Enabled role, provide the minimum Ansible Container version.
# min_ansible_container_version:
galaxy_tags: []
# List tags for your role here, one per line. A tag is a keyword that describes
# and categorizes the role. Users find roles by searching for tags. Be sure to
# remove the '[]' above, if you add tags to this list.
#
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
# Maximum 20 tags per role.
dependencies: []
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
# if you add dependencies to this list.

View file

@ -0,0 +1,29 @@
---
- name: Create Paperless stack environment directory
ansible.builtin.file:
state: directory
path: "{{ stack_paperless_env_dir }}"
owner: root
group: root
mode: 0700
- name: Create user-facing data dir
ansible.builtin.file:
state: directory
path: "{{ stack_paperless_serve_dir }}/{{ item }}"
owner: "{{ stack_paperless_puid }}"
group: "{{ stack_paperless_pgid }}"
mode: 0770
when: stack_paperless_serve_dir_create
loop:
- ""
- documents
- consume
- name: Start compose stack
community.docker.docker_compose_v2:
project_name: paperless
definition: "{{ lookup('template', 'docker-compose.yaml.j2') | from_yaml }}"
remove_orphans: true
wait: true
wait_timeout: 60

View file

@ -0,0 +1,80 @@
services:
paperless:
container_name: paperless
image: ghcr.io/paperless-ngx/paperless-ngx:latest
restart: unless-stopped
networks:
- caddy
- backend
security_opt:
- no-new-privileges:true
depends_on:
- paperless-redis
- paperless-postgres
volumes:
- "{{ stack_paperless_env_dir }}/data/paperless:/usr/src/paperless/data" # container data
- "{{ stack_paperless_env_dir }}/data/paperless_export:/usr/src/paperless/export" # backup location
- "{{ stack_paperless_serve_dir }}/documents:/usr/src/paperless/media" # document location
- "{{ stack_paperless_serve_dir }}/consume:/usr/src/paperless/consume" # watch folder
environment:
- "PAPERLESS_TIME_ZONE={{ stack_paperless_tz }}"
- "USERMAP_UID={{ stack_paperless_puid }}"
- "USERMAP_GID={{ stack_paperless_pgid }}"
- "PAPERLESS_OCR_LANGUAGE={{ stack_paperless_ocr_language }}"
- "PAPERLESS_OCR_LANGUAGES={{ stack_paperless_ocr_languages }}"
- "PAPERLESS_OCR_SKIP_ARCHIVE_FILE={{ stack_paperless_ocr_skip_archive_file }}"
- "PAPERLESS_ENABLE_UPDATE_CHECK={{ stack_paperless_enable_update_check }}"
- "PAPERLESS_REDIS=redis://paperless-redis:6379"
- "PAPERLESS_DBHOST=paperless-postgres"
- "PAPERLESS_DBNAME={{ stack_paperless_dbname }}"
- "PAPERLESS_DBUSER={{ stack_paperless_dbuser }}"
- "PAPERLESS_DBPASS={{ stack_paperless_dbpass }}"
- "PAPERLESS_SECRET_KEY={{ stack_paperless_secret_key }}"
- "PAPERLESS_FILENAME_FORMAT={{ stack_paperless_filename_format }}"
- "PAPERLESS_ADMIN_USER={{ stack_paperless_admin_user }}"
- "PAPERLESS_ADMIN_PASSWORD={{ stack_paperless_admin_password }}"
labels:
caddy: "http://documents.pichi.berlin"
caddy.reverse_proxy: "{{ '{{' }}upstreams 8000{{ '}}'}}"
paperless-postgres:
container_name: paperless-postgres
image: postgres:16.0-alpine #fixedVersion
restart: unless-stopped
networks:
- backend
security_opt:
- no-new-privileges:true
volumes:
- "{{ stack_paperless_env_dir }}/data/postgres:/var/lib/postgresql/data"
environment:
POSTGRES_DB: "{{ stack_paperless_dbname }}"
POSTGRES_USER: "{{ stack_paperless_dbuser }}"
POSTGRES_PASSWORD: "{{ stack_paperless_dbpass }}"
paperless-redis:
container_name: paperless-redis
image: redis:7.2-alpine #fixedVersion
restart: unless-stopped
networks:
- backend
security_opt:
- no-new-privileges:true
volumes:
- "{{ stack_paperless_env_dir }}/data/redis:/data"
environment:
REDIS_ARGS: "--save 60 10"
networks:
caddy:
external: true
backend:
name: backend
driver: bridge
# secrets:
# paperless_db_paperless_passwd:
# file: ./secrets/paperless_db_paperless_passwd
# paperless_secret_key:
# file: ./secrets/paperless_secret_key
#

View file

@ -0,0 +1,2 @@
localhost

View file

@ -0,0 +1,5 @@
---
- hosts: localhost
remote_user: root
roles:
- paperless

View file

@ -0,0 +1,2 @@
---
# vars file for paperless