Files
playbooks/paperless-ngx/roles/paperless/tasks/main.yaml
T

51 lines
1.7 KiB
YAML

---
- name: Pull image
docker_image:
name: "{{ image_name }}"
source: pull
force_source: yes
- name: Ensure Paperless Directories exists
file:
path: "{{ item }}"
state: directory
mode: "0755"
loop:
- "/var/lib/{{ host_directory }}"
- "/var/lib/{{ host_directory }}/data"
- name: Run Paperless-NGX Docker container
community.docker.docker_container:
name: "{{ container_name }}"
image: "{{ image_name }}:{{ image_version }}"
state: started
restart_policy: unless-stopped
networks:
- name: "{{ docker_network }}"
env:
PAPERLESS_URL: "https://{{ host }}"
PAPERLESS_REDIS: redis://{{ redis_container }}:6379
PAPERLESS_DBHOST: "{{ postgres_container }}"
PAPERLESS_DBUSER: "{{ postgres_user }}"
PAPERLESS_DBPASS: "{{ postgres_password }}"
PAPERLESS_DBNAME: "{{ postgres_db }}"
PAPERLESS_TIME_ZONE: "{{ paperless_time_zone }}"
USERMAP_UID: "{{ paperless_uid }}"
USERMAP_GID: "{{ paperless_uid }}"
PAPERLESS_CONSUMER_RECURSIVE: "true"
# inotify cannot see changes made remotely through WebDAV, so poll
PAPERLESS_CONSUMER_POLLING: "60"
PAPERLESS_OCR_USER_ARGS: '{"invalidate_digital_signatures": true}'
volumes:
- "/var/lib/{{ host_directory }}/data:/usr/src/paperless/data"
- "/mnt/paperless/media:/usr/src/paperless/media:rslave"
- "/mnt/paperless/export:/usr/src/paperless/export:rslave"
- "/mnt/paperless/consume:/usr/src/paperless/consume:rslave"
- name: Export documents nightly to the Nextcloud export folder
cron:
name: Paperless export
minute: "30"
hour: "2"
job: "docker exec {{ container_name }} document_exporter ../export -d"