Skip to content

Instantly share code, notes, and snippets.

@Tronde
Forked from knumskull/paperless.yml
Created February 9, 2023 19:53
Show Gist options
  • Save Tronde/64d5387647df9c570de3e5a6b310fd96 to your computer and use it in GitHub Desktop.
Save Tronde/64d5387647df9c570de3e5a6b310fd96 to your computer and use it in GitHub Desktop.
---
- name: run containers
hosts: localhost
gather_facts: true
roles:
- linux-system-roles.network
- sfroemer_podman_network
vars_files:
- config/accounts.vault
- config/infrastructure.vault
pre_tasks:
- name: wait until server is up and running
ansible.builtin.wait_for_connection:
timeout: 900
tags: ['always']
- name: Check if login to registry registry.redhat.io exists
containers.podman.podman_login_info:
registry: registry.redhat.io
register: registry_result
tags: ['always']
- name: Login to registry.redhat.io
containers.podman.podman_login:
username: "{{ REDHAT_REGISTRY_LOGIN }}"
password: "{{ REDHAT_REGISTRY_PASSWORD }}"
registry: registry.redhat.io
when: not registry_result.login.logged_in
tags: ['always']
tasks:
############################################################################
#
# Paperless
#
#
#
############################################################################
- name: create Paperless Volume {{ item.name }}
containers.podman.podman_volume:
name: "{{ item.name }}"
state: present
with_items:
- {"name": "paperless-data"}
- {"name": "paperless-media"}
- {"name": "paperless-export"}
- {"name": "paperless-consume"}
- {"name": "paperless-redisdata"}
- {"name": "paperless-pgdata"}
tags:
- never
- paperless
- name: Create Paperless CIFS consume volume
containers.podman.podman_volume:
name: "paperless-cifs"
state: present
driver: "local"
recreate: no
options:
- "type=cifs"
- "device=//{{ CRAZY_LAB_NAS }}/Documents"
- "o=uid=1000,gid=1000,user={{ PAPERLESS_CIFS_USER }},password={{ PAPERLESS_CIFS_PASSWORD }},context=system_u:object_r:svirt_sandbox_file_t:s0"
tags:
- never
- paperless
- name: Paperless Broker
containers.podman.podman_container:
name: paperless-broker
image: "registry.redhat.io/rhel9/redis-6"
state: started
recreate: yes
volume: "paperless-redisdata:/data:Z"
tags:
- never
- paperless
- name: Paperless Database
containers.podman.podman_container:
name: paperless-db
image: "registry.redhat.io/rhel9/postgresql-13"
state: started
recreate: no
volume: "paperless-pgdata:/var/lib/pgsql/data:Z"
env:
POSTGRESQL_DATABASE: paperless
POSTGRESQL_USER: "{{ PAPERLESS_DBUSER }}"
POSTGRESQL_PASSWORD: "{{ PAPERLESS_POSTGRES_PASSWORD }}"
tags:
- never
- paperless
- name: Paperless webserver
containers.podman.podman_container:
name: paperless-web
image: ghcr.io/paperless-ngx/paperless-ngx:latest
state: started
ports:
- 8000:8000
volume:
- "paperless-data:/usr/src/paperless/data:Z"
- "paperless-media:/usr/src/paperless/media:Z"
- "paperless-export:/usr/src/paperless/export:Z"
# - "paperless-consume:/usr/src/paperless/consume:Z"
- "paperless-cifs:/usr/src/paperless/consume"
recreate: no
healthcheck: "-c /usr/bin/curl -fs -S --max-time 2 http://localhost:8000 || exit 1"
healthcheck_interval: 30s
healthcheck_timeout: 10s
healthcheck_retries: 5
env:
PAPERLESS_REDIS: redis://paperless-broker:6379
PAPERLESS_DBHOST: paperless-db
PAPERLESS_DBUSER: "{{ PAPERLESS_DBUSER }}"
PAPERLESS_DBPASS: "{{ PAPERLESS_POSTGRES_PASSWORD }}"
PAPERLESS_SECRET_KEY: "{{ PAPERLESS_SECRET_KEY }}"
PAPERLESS_AUTO_LOGIN_USERNAME: "{{ PAPERLESS_AUTO_LOGIN_USERNAME | default(omit) }}"
PAPERLESS_ADMIN_USER: "{{ PAPERLESS_ADMIN_USER }}"
PAPERLESS_ADMIN_MAIL: "{{ PAPERLESS_ADMIN_MAIL }}"
PAPERLESS_ADMIN_PASSWORD: "{{ PAPERLESS_ADMIN_PASSWORD }}"
PAPERLESS_OCR_LANGUAGE: "deu+eng"
PAPERLESS_TIME_ZONE: 'Europe/Berlin'
PAPERLESS_CONSUMER_POLLING: 300
PAPERLESS_CONSUMER_POLLING_DELAY: 10
PAPERLESS_CONSUMER_POLLING_RETRY_COUNT: 6
tags:
- never
- paperless
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment