Merge pull request #109 from slankes/removeansible
chore: remove ansible playbooks and documentation
This commit is contained in:
		
						commit
						2f7c351039
					
				
							
								
								
									
										78
									
								
								.github/workflows/ansible.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										78
									
								
								.github/workflows/ansible.yml
									
									
									
									
										vendored
									
									
								
							@ -1,78 +0,0 @@
 | 
				
			|||||||
---
 | 
					 | 
				
			||||||
name: Ansible Role
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
on:
 | 
					 | 
				
			||||||
  push:
 | 
					 | 
				
			||||||
    branches-ignore:
 | 
					 | 
				
			||||||
      - 'translations**'
 | 
					 | 
				
			||||||
  pull_request:
 | 
					 | 
				
			||||||
    branches-ignore:
 | 
					 | 
				
			||||||
      - 'translations**'
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
jobs:
 | 
					 | 
				
			||||||
  # https://molecule.readthedocs.io/en/latest/ci.html#github-actions
 | 
					 | 
				
			||||||
  test:
 | 
					 | 
				
			||||||
    runs-on: ubuntu-latest
 | 
					 | 
				
			||||||
    steps:
 | 
					 | 
				
			||||||
      - name: Check out the codebase
 | 
					 | 
				
			||||||
        uses: actions/checkout@v2
 | 
					 | 
				
			||||||
        if: github.event_name != 'pull_request'
 | 
					 | 
				
			||||||
        with:
 | 
					 | 
				
			||||||
          path: "${{ github.repository }}"
 | 
					 | 
				
			||||||
      - name: Check out the codebase
 | 
					 | 
				
			||||||
        uses: actions/checkout@v2
 | 
					 | 
				
			||||||
        if: github.event_name == 'pull_request'
 | 
					 | 
				
			||||||
        with:
 | 
					 | 
				
			||||||
          # merge commit is not available from tree at this point in time
 | 
					 | 
				
			||||||
          # https://github.com/actions/checkout#checkout-pull-request-head-commit-instead-of-merge-commit
 | 
					 | 
				
			||||||
          ref: "${{ github.event.pull_request.head.sha }}"
 | 
					 | 
				
			||||||
          path: "${{ github.repository }}"
 | 
					 | 
				
			||||||
      - name: Set up Python
 | 
					 | 
				
			||||||
        uses: actions/setup-python@v2
 | 
					 | 
				
			||||||
      - name: Set up Docker
 | 
					 | 
				
			||||||
        uses: docker-practice/actions-setup-docker@master
 | 
					 | 
				
			||||||
      - name: Install dependencies
 | 
					 | 
				
			||||||
        run: |
 | 
					 | 
				
			||||||
          python3 -m pip install --upgrade pip
 | 
					 | 
				
			||||||
          python3 -m pip install molecule[ansible,docker] jmespath
 | 
					 | 
				
			||||||
          ansible --version
 | 
					 | 
				
			||||||
          docker --version
 | 
					 | 
				
			||||||
          molecule --version
 | 
					 | 
				
			||||||
          python --version
 | 
					 | 
				
			||||||
      - name: Test installation/build/upgrade with molecule
 | 
					 | 
				
			||||||
        run: |
 | 
					 | 
				
			||||||
          cd ansible
 | 
					 | 
				
			||||||
          molecule create
 | 
					 | 
				
			||||||
          molecule verify
 | 
					 | 
				
			||||||
          molecule converge
 | 
					 | 
				
			||||||
          molecule idempotence
 | 
					 | 
				
			||||||
          molecule verify
 | 
					 | 
				
			||||||
        working-directory: "${{ github.repository }}"
 | 
					 | 
				
			||||||
        env:
 | 
					 | 
				
			||||||
          TARGET_GITHUB_SHA: "${{ github.event.pull_request.head.sha }}"
 | 
					 | 
				
			||||||
  # # https://galaxy.ansible.com/docs/contributing/importing.html
 | 
					 | 
				
			||||||
  # release:
 | 
					 | 
				
			||||||
  #   runs-on: ubuntu-latest
 | 
					 | 
				
			||||||
  #   needs:
 | 
					 | 
				
			||||||
  #     - test
 | 
					 | 
				
			||||||
  #   # https://docs.github.com/en/free-pro-team@latest/actions/reference/context-and-expression-syntax-for-github-actions#github-context
 | 
					 | 
				
			||||||
  #   if: contains(github.ref, 'refs/tags/')
 | 
					 | 
				
			||||||
  #   steps:
 | 
					 | 
				
			||||||
  #     - name: Check out the codebase
 | 
					 | 
				
			||||||
  #       uses: actions/checkout@v2
 | 
					 | 
				
			||||||
  #       with:
 | 
					 | 
				
			||||||
  #         path: "${{ github.repository }}"
 | 
					 | 
				
			||||||
  #     - name: Set up Python
 | 
					 | 
				
			||||||
  #       uses: actions/setup-python@v2
 | 
					 | 
				
			||||||
  #     - name: Install dependencies
 | 
					 | 
				
			||||||
  #       run: |
 | 
					 | 
				
			||||||
  #         python3 -m pip install --upgrade ansible-base
 | 
					 | 
				
			||||||
  #         ansible --version
 | 
					 | 
				
			||||||
  #         python --version
 | 
					 | 
				
			||||||
  #     - name: Trigger a new import on Galaxy
 | 
					 | 
				
			||||||
  #     # TODO Check if source if pulled from cwd or imported from github
 | 
					 | 
				
			||||||
  #     # https://github.com/ansible/ansible/blob/devel/lib/ansible/cli/galaxy.py
 | 
					 | 
				
			||||||
  #       run: |
 | 
					 | 
				
			||||||
  #         cd ansible
 | 
					 | 
				
			||||||
  #         ansible-galaxy role import --api-key ${{ secrets.GALAXY_API_KEY }} $(echo ${{ github.repository }} | cut -d/ -f1) $(echo ${{ github.repository }} | cut -d/ -f2)
 | 
					 | 
				
			||||||
  #       working-directory: "${{ github.repository }}"
 | 
					 | 
				
			||||||
@ -1,5 +1,4 @@
 | 
				
			|||||||
[](https://github.com/jonaswinkler/paperless-ng/actions)
 | 
					[](https://github.com/jonaswinkler/paperless-ng/actions)
 | 
				
			||||||

 | 
					 | 
				
			||||||
[](https://crwd.in/paperless-ngx)
 | 
					[](https://crwd.in/paperless-ngx)
 | 
				
			||||||
[](https://paperless-ng.readthedocs.io/en/latest/?badge=latest)
 | 
					[](https://paperless-ng.readthedocs.io/en/latest/?badge=latest)
 | 
				
			||||||
[](https://gitter.im/paperless-ng/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
 | 
					[](https://gitter.im/paperless-ng/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
 | 
				
			||||||
@ -76,7 +75,7 @@ The recommended way to deploy paperless is docker-compose. The files in the /doc
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
Read the [documentation](https://paperless-ng.readthedocs.io/en/latest/setup.html#installation) on how to get started.
 | 
					Read the [documentation](https://paperless-ng.readthedocs.io/en/latest/setup.html#installation) on how to get started.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Alternatively, you can install the dependencies and setup apache and a database server yourself. The documenation has a step by step guide on how to do it. Consider giving the Ansible role a shot, this essentially automates the entire bare metal installation process.
 | 
					Alternatively, you can install the dependencies and setup apache and a database server yourself. The documenation has a step by step guide on how to do it.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Migrating from Paperless to Paperless-ng
 | 
					# Migrating from Paperless to Paperless-ng
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -1,116 +0,0 @@
 | 
				
			|||||||
Ansible Role: paperless-ng
 | 
					 | 
				
			||||||
==========================
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Installs and configures paperless-ng EDMS on Debian/Ubuntu systems.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Requirements
 | 
					 | 
				
			||||||
------------
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
No special system requirements. Ansible 2.7 or newer is required.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Note that this role requires root access, so either run it in a playbook with a global `become: yes`, or invoke the role in your playbook like:
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    - hosts: all
 | 
					 | 
				
			||||||
      roles:
 | 
					 | 
				
			||||||
        - role: paperless-ng
 | 
					 | 
				
			||||||
          become: yes
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Role Variables
 | 
					 | 
				
			||||||
--------------
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Most configuration variables from paperless-ng itself are available and accept their respective arguments.
 | 
					 | 
				
			||||||
Every `PAPERLESS_*` configuration variable is lowercased and instead prefixed with `paperlessng_*` in `defaults/main.yml`.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
For a full listing including explanations and allowed values, see the current [documentation](https://paperless-ng.readthedocs.io/en/latest/configuration.html).
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Additional variables available in this role are listed below, along with default values:
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    paperlessng_version: latest
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
The [release](https://github.com/jonaswinkler/paperless-ng/releases) archive version of paperless-ng to install.
 | 
					 | 
				
			||||||
`latest` stands for the latest release of paperless-ng.
 | 
					 | 
				
			||||||
To install a specific version of paperless-ng, use the tag name of the release, e. g. `ng-1.4.4`, or specify a branch or commit id.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    paperlessng_redis_host: localhost
 | 
					 | 
				
			||||||
    paperlessng_redis_port: 6379
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Separate configuration values that combine into `PAPERLESS_REDIS`.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    paperlessng_db_type: sqlite
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Database to use. Default is file-based SQLite.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    paperlessng_db_host: localhost
 | 
					 | 
				
			||||||
    paperlessng_db_port: 5432
 | 
					 | 
				
			||||||
    paperlessng_db_name: paperlessng
 | 
					 | 
				
			||||||
    paperlessng_db_user: paperlessng
 | 
					 | 
				
			||||||
    paperlessng_db_pass: paperlessng
 | 
					 | 
				
			||||||
    paperlessng_db_sslmode: prefer
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Database configuration (only applicable if `paperlessng_db_type == 'postgresql'`).
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    paperlessng_directory: /opt/paperless-ng
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Root directory paperless-ng is installed into.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    paperlessng_virtualenv: "{{ paperlessng_directory }}/.venv"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Directory used for the virtual environment for paperless-ng.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    paperlessng_ocr_languages:
 | 
					 | 
				
			||||||
      - eng
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
List of OCR languages to install and configure (`apt search tesseract-ocr-*`).
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    paperlessng_use_jbig2enc: True
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Whether to install and use [jbig2enc](https://github.com/agl/jbig2enc) for OCRmyPDF.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    paperlessng_big2enc_lossy: False
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Whether to use jbig2enc's lossy compression mode.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    paperlessng_superuser_name: paperlessng
 | 
					 | 
				
			||||||
    paperlessng_superuser_email: paperlessng@example.com
 | 
					 | 
				
			||||||
    paperlessng_superuser_password: paperlessng
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Credentials of the initial superuser in paperless-ng.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    paperlessng_system_user: paperlessng
 | 
					 | 
				
			||||||
    paperlessng_system_group: paperlessng
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
System user and group to run the paperless-ng services as (will be created if required).
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    paperlessng_listen_address: 127.0.0.1
 | 
					 | 
				
			||||||
    paperlessng_listen_port: 8000
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Address and port for the paperless-ng service to listen on.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Dependencies
 | 
					 | 
				
			||||||
------------
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
No ansible dependencies.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Example Playbook
 | 
					 | 
				
			||||||
----------------
 | 
					 | 
				
			||||||
`playbook.yml`:
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    - hosts: all
 | 
					 | 
				
			||||||
      become: yes
 | 
					 | 
				
			||||||
      vars_files:
 | 
					 | 
				
			||||||
        - vars/paperless-ng.yml
 | 
					 | 
				
			||||||
      roles:
 | 
					 | 
				
			||||||
        - paperless-ng
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
`vars/paperless-ng.yml`:
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    paperlessng_media_root: /mnt/media/smbshare
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    paperlessng_db_type: postgresql
 | 
					 | 
				
			||||||
    paperlessng_db_pass: PLEASEPROVIDEASTRONGPASSWORDHERE
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    paperlessng_secret_key: AGAINPLEASECHANGETHISNOW
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    paperlessng_ocr_languages:
 | 
					 | 
				
			||||||
      - eng
 | 
					 | 
				
			||||||
      - deu
 | 
					 | 
				
			||||||
@ -1,85 +0,0 @@
 | 
				
			|||||||
---
 | 
					 | 
				
			||||||
paperlessng_version: latest  # 'latest', release number, or github branch/tag/commit/ref
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Required services
 | 
					 | 
				
			||||||
paperlessng_redis_host: localhost
 | 
					 | 
				
			||||||
paperlessng_redis_port: 6379
 | 
					 | 
				
			||||||
paperlessng_db_type: sqlite # or postgresql
 | 
					 | 
				
			||||||
# Below entries only apply for paperlessng_db_type=='postgresql'
 | 
					 | 
				
			||||||
paperlessng_db_host: localhost
 | 
					 | 
				
			||||||
paperlessng_db_port: 5432
 | 
					 | 
				
			||||||
paperlessng_db_name: paperlessng
 | 
					 | 
				
			||||||
paperlessng_db_user: paperlessng
 | 
					 | 
				
			||||||
paperlessng_db_pass: paperlessng
 | 
					 | 
				
			||||||
paperlessng_db_sslmode: prefer
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Paths and folders
 | 
					 | 
				
			||||||
paperlessng_directory: /opt/paperless-ng
 | 
					 | 
				
			||||||
paperlessng_consumption_dir: "{{ paperlessng_directory }}/consumption"
 | 
					 | 
				
			||||||
paperlessng_data_dir: "{{ paperlessng_directory }}/data"
 | 
					 | 
				
			||||||
paperlessng_trash_dir:
 | 
					 | 
				
			||||||
paperlessng_media_root: "{{ paperlessng_directory }}/media"
 | 
					 | 
				
			||||||
paperlessng_staticdir: "{{ paperlessng_directory }}/static"
 | 
					 | 
				
			||||||
paperlessng_filename_format:
 | 
					 | 
				
			||||||
paperlessng_logging_dir: "{{ paperlessng_data_dir }}/log"
 | 
					 | 
				
			||||||
paperlessng_virtualenv: "{{ paperlessng_directory }}/.venv"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Hosting & Security
 | 
					 | 
				
			||||||
paperlessng_secret_key: PLEASECHANGETHISFORTHELOVEOFGOD
 | 
					 | 
				
			||||||
paperlessng_allowed_hosts: "*"
 | 
					 | 
				
			||||||
paperlessng_cors_allowed_hosts: http://localhost:8000
 | 
					 | 
				
			||||||
paperlessng_force_script_name:
 | 
					 | 
				
			||||||
paperlessng_static_url: /static/
 | 
					 | 
				
			||||||
paperlessng_auto_login_username:
 | 
					 | 
				
			||||||
paperlessng_cookie_prefix: ""
 | 
					 | 
				
			||||||
paperlessng_enable_http_remote_user: False
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# OCR settings
 | 
					 | 
				
			||||||
paperlessng_ocr_languages:
 | 
					 | 
				
			||||||
  - eng
 | 
					 | 
				
			||||||
paperlessng_ocr_mode: skip
 | 
					 | 
				
			||||||
paperlessng_ocr_clean: clean
 | 
					 | 
				
			||||||
paperlessng_ocr_deskew: True
 | 
					 | 
				
			||||||
paperlessng_ocr_rotate_pages: True
 | 
					 | 
				
			||||||
paperlessng_ocr_rotate_pages_threshold: 12
 | 
					 | 
				
			||||||
paperlessng_ocr_output_type: pdfa
 | 
					 | 
				
			||||||
paperlessng_ocr_pages: 0
 | 
					 | 
				
			||||||
paperlessng_ocr_image_dpi:
 | 
					 | 
				
			||||||
# see https://ocrmypdf.readthedocs.io/en/latest/api.html#ocrmypdf.ocr
 | 
					 | 
				
			||||||
paperlessng_ocr_user_args:
 | 
					 | 
				
			||||||
  - "optimize": 1
 | 
					 | 
				
			||||||
paperlessng_use_jbig2enc: True
 | 
					 | 
				
			||||||
paperlessng_big2enc_lossy: False
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Tika settings
 | 
					 | 
				
			||||||
paperlessng_tika_enabled: False
 | 
					 | 
				
			||||||
paperlessng_tika_endpoint: http://localhost:9998
 | 
					 | 
				
			||||||
paperlessng_tika_gotenberg_endpoint: http://localhost:3000
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Software tweaks
 | 
					 | 
				
			||||||
paperlessng_time_zone: Europe/Berlin
 | 
					 | 
				
			||||||
paperlessng_consumer_polling: 0
 | 
					 | 
				
			||||||
paperlessng_consumer_delete_duplicates: False
 | 
					 | 
				
			||||||
paperlessng_consumer_recursive: False
 | 
					 | 
				
			||||||
paperlessng_consumer_subdirs_as_tags: False
 | 
					 | 
				
			||||||
paperlessng_convert_memory_limit: 0
 | 
					 | 
				
			||||||
paperlessng_convert_tmpdir:
 | 
					 | 
				
			||||||
paperlessng_optimize_thumbnails: True
 | 
					 | 
				
			||||||
paperlessng_pre_consume_script:
 | 
					 | 
				
			||||||
paperlessng_post_consume_script:
 | 
					 | 
				
			||||||
paperlessng_filename_date_order:
 | 
					 | 
				
			||||||
paperlessng_thumbnail_font_name: /usr/share/fonts/liberation/LiberationSerif-Regular.ttf
 | 
					 | 
				
			||||||
paperlessng_ignore_dates: ""
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Superuser settings
 | 
					 | 
				
			||||||
paperlessng_superuser_name: paperlessng
 | 
					 | 
				
			||||||
paperlessng_superuser_email: paperlessng@example.com
 | 
					 | 
				
			||||||
paperlessng_superuser_password: paperlessng
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# System user settings
 | 
					 | 
				
			||||||
paperlessng_system_user: paperlessng
 | 
					 | 
				
			||||||
paperlessng_system_group: paperlessng
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Webserver settings
 | 
					 | 
				
			||||||
paperlessng_listen_address: 127.0.0.1
 | 
					 | 
				
			||||||
paperlessng_listen_port: 8000
 | 
					 | 
				
			||||||
@ -1,19 +0,0 @@
 | 
				
			|||||||
dependencies: []
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
galaxy_info:
 | 
					 | 
				
			||||||
  author: C0nsultant
 | 
					 | 
				
			||||||
  description: Bare-metal deployment of paperless-ng DMS
 | 
					 | 
				
			||||||
  license: license (GPLv3)
 | 
					 | 
				
			||||||
  min_ansible_version: 2.7
 | 
					 | 
				
			||||||
  namespace: paperless_ng
 | 
					 | 
				
			||||||
  role_name: paperless_ng
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  platforms:
 | 
					 | 
				
			||||||
    - name: Debian
 | 
					 | 
				
			||||||
      versions:
 | 
					 | 
				
			||||||
        - buster
 | 
					 | 
				
			||||||
    - name: Ubuntu
 | 
					 | 
				
			||||||
      versions:
 | 
					 | 
				
			||||||
        - focal
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  galaxy_tags: [EDMS, django, python, web]
 | 
					 | 
				
			||||||
@ -1,10 +0,0 @@
 | 
				
			|||||||
---
 | 
					 | 
				
			||||||
- name: update previous release to newest release
 | 
					 | 
				
			||||||
  hosts: all
 | 
					 | 
				
			||||||
  tasks:
 | 
					 | 
				
			||||||
    - name: set current github commit as version when available
 | 
					 | 
				
			||||||
      set_fact:
 | 
					 | 
				
			||||||
        paperlessng_version: "{{ lookup('env', 'TARGET_GITHUB_SHA') | default('master', True) }}"
 | 
					 | 
				
			||||||
    - name: update to newest paperless-ng release
 | 
					 | 
				
			||||||
      include_role:
 | 
					 | 
				
			||||||
        name: ansible
 | 
					 | 
				
			||||||
@ -1,35 +0,0 @@
 | 
				
			|||||||
---
 | 
					 | 
				
			||||||
dependency:
 | 
					 | 
				
			||||||
  name: galaxy
 | 
					 | 
				
			||||||
driver:
 | 
					 | 
				
			||||||
  name: docker
 | 
					 | 
				
			||||||
platforms:
 | 
					 | 
				
			||||||
  - name: ubuntu_focal
 | 
					 | 
				
			||||||
    image: jrei/systemd-ubuntu:20.04
 | 
					 | 
				
			||||||
    privileged: true
 | 
					 | 
				
			||||||
    volumes:
 | 
					 | 
				
			||||||
      - /sys/fs/cgroup:/sys/fs/cgroup:ro
 | 
					 | 
				
			||||||
    tmpfs:
 | 
					 | 
				
			||||||
      - /tmp
 | 
					 | 
				
			||||||
      - /run
 | 
					 | 
				
			||||||
      - /run/lock
 | 
					 | 
				
			||||||
    override_command: False
 | 
					 | 
				
			||||||
  # ubuntu 18.04 bionic works except that
 | 
					 | 
				
			||||||
  #   the default redis configuration expects IPv6 which is not enabled in docker by default
 | 
					 | 
				
			||||||
  #   the default Python environment is configured for ASCII instead of UTF-8
 | 
					 | 
				
			||||||
  # ubuntu 16.04 xenial only has Python 3.5 which is EOL and breaks multiple dependencies
 | 
					 | 
				
			||||||
  - name: debian_buster
 | 
					 | 
				
			||||||
    image: jrei/systemd-debian:10
 | 
					 | 
				
			||||||
    privileged: true
 | 
					 | 
				
			||||||
    volumes:
 | 
					 | 
				
			||||||
      - /sys/fs/cgroup:/sys/fs/cgroup:ro
 | 
					 | 
				
			||||||
    tmpfs:
 | 
					 | 
				
			||||||
      - /tmp
 | 
					 | 
				
			||||||
      - /run
 | 
					 | 
				
			||||||
      - /run/lock
 | 
					 | 
				
			||||||
    override_command: False
 | 
					 | 
				
			||||||
  # debian 9 stretch only has Python 3.5 which is EOL and breaks multiple dependencies
 | 
					 | 
				
			||||||
provisioner:
 | 
					 | 
				
			||||||
  name: ansible
 | 
					 | 
				
			||||||
verifier:
 | 
					 | 
				
			||||||
  name: ansible
 | 
					 | 
				
			||||||
@ -1,10 +0,0 @@
 | 
				
			|||||||
- name: install previous release
 | 
					 | 
				
			||||||
  hosts: all
 | 
					 | 
				
			||||||
  tasks:
 | 
					 | 
				
			||||||
    - name: set previous version as installation target
 | 
					 | 
				
			||||||
      set_fact:
 | 
					 | 
				
			||||||
        paperlessng_version: latest
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    - name: install previous paperless-ng release
 | 
					 | 
				
			||||||
      include_role:
 | 
					 | 
				
			||||||
        name: ansible
 | 
					 | 
				
			||||||
@ -1,94 +0,0 @@
 | 
				
			|||||||
---
 | 
					 | 
				
			||||||
- name: Verify
 | 
					 | 
				
			||||||
  hosts: all
 | 
					 | 
				
			||||||
  gather_facts: false
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  vars_files:
 | 
					 | 
				
			||||||
    - ../../defaults/main.yml
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  tasks:
 | 
					 | 
				
			||||||
    - name: check if webserver is up
 | 
					 | 
				
			||||||
      uri:
 | 
					 | 
				
			||||||
        url: "http://{{ paperlessng_listen_address }}:{{ paperlessng_listen_port }}"
 | 
					 | 
				
			||||||
        status_code: [200, 302]
 | 
					 | 
				
			||||||
        return_content: yes
 | 
					 | 
				
			||||||
      register: landingpage
 | 
					 | 
				
			||||||
      failed_when: "'Sign in</button>' not in landingpage.content"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    - name: generate random name and content
 | 
					 | 
				
			||||||
      set_fact:
 | 
					 | 
				
			||||||
        content: "{{ lookup('password', '/dev/null length=65536 chars=ascii_letters') }}"
 | 
					 | 
				
			||||||
        filename: "{{ lookup('password', '/dev/null length=8 chars=ascii_letters') }}"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    - name: check if document posting works
 | 
					 | 
				
			||||||
      uri:
 | 
					 | 
				
			||||||
        url: "http://{{ paperlessng_listen_address }}:{{ paperlessng_listen_port }}/api/documents/post_document/"
 | 
					 | 
				
			||||||
        method: POST
 | 
					 | 
				
			||||||
        body_format: form-multipart
 | 
					 | 
				
			||||||
        body:
 | 
					 | 
				
			||||||
          document:
 | 
					 | 
				
			||||||
            content: "{{ content }}"
 | 
					 | 
				
			||||||
            filename: "{{ filename }}.txt"
 | 
					 | 
				
			||||||
        headers:
 | 
					 | 
				
			||||||
          Authorization: 'Basic {{ (paperlessng_superuser_name + ":" + paperlessng_superuser_password) | b64encode }}'
 | 
					 | 
				
			||||||
          Content-Type: text/plain
 | 
					 | 
				
			||||||
        return_content: yes
 | 
					 | 
				
			||||||
      register: post_document
 | 
					 | 
				
			||||||
      failed_when: "'OK' not in post_document.content"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    - name: verify uploaded document has been accepted
 | 
					 | 
				
			||||||
      uri:
 | 
					 | 
				
			||||||
        url: "http://{{ paperlessng_listen_address }}:{{ paperlessng_listen_port }}/api/logs/paperless/"
 | 
					 | 
				
			||||||
        headers:
 | 
					 | 
				
			||||||
          Authorization: 'Basic {{ (paperlessng_superuser_name + ":" + paperlessng_superuser_password) | b64encode }}'
 | 
					 | 
				
			||||||
        return_content: yes
 | 
					 | 
				
			||||||
      register: logs
 | 
					 | 
				
			||||||
      failed_when: "('Consuming ' + filename + '.txt') not in logs.content"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    - name: sleep till consumption finished
 | 
					 | 
				
			||||||
      pause:
 | 
					 | 
				
			||||||
        seconds: 10
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    - name: verify uploaded document has been consumed
 | 
					 | 
				
			||||||
      uri:
 | 
					 | 
				
			||||||
        url: "http://{{ paperlessng_listen_address }}:{{ paperlessng_listen_port }}/api/logs/paperless/"
 | 
					 | 
				
			||||||
        headers:
 | 
					 | 
				
			||||||
          Authorization: 'Basic {{ (paperlessng_superuser_name + ":" + paperlessng_superuser_password) | b64encode }}'
 | 
					 | 
				
			||||||
        return_content: yes
 | 
					 | 
				
			||||||
      register: logs
 | 
					 | 
				
			||||||
      failed_when: "filename + ' consumption finished' not in logs.content"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    - name: get documents
 | 
					 | 
				
			||||||
      uri:
 | 
					 | 
				
			||||||
        url: "http://{{ paperlessng_listen_address }}:{{ paperlessng_listen_port }}/api/documents/"
 | 
					 | 
				
			||||||
        headers:
 | 
					 | 
				
			||||||
          Authorization: 'Basic {{ (paperlessng_superuser_name + ":" + paperlessng_superuser_password) | b64encode }}'
 | 
					 | 
				
			||||||
        return_content: yes
 | 
					 | 
				
			||||||
      register: documents
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    - name: set document index
 | 
					 | 
				
			||||||
      set_fact:
 | 
					 | 
				
			||||||
        index: "{{ documents.json['results'][0]['id'] }}"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    - name: verify uploaded document is avaiable
 | 
					 | 
				
			||||||
      uri:
 | 
					 | 
				
			||||||
        url: "http://{{ paperlessng_listen_address }}:{{ paperlessng_listen_port }}/api/documents/{{ index }}/"
 | 
					 | 
				
			||||||
        headers:
 | 
					 | 
				
			||||||
          Authorization: 'Basic {{ (paperlessng_superuser_name + ":" + paperlessng_superuser_password) | b64encode }}'
 | 
					 | 
				
			||||||
        return_content: yes
 | 
					 | 
				
			||||||
      register: document
 | 
					 | 
				
			||||||
      failed_when: "'Not found.' in document.content or content not in document.json['content']"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    - name: check if deleting uploaded document works
 | 
					 | 
				
			||||||
      uri:
 | 
					 | 
				
			||||||
        url: "http://{{ paperlessng_listen_address }}:{{ paperlessng_listen_port }}/api/documents/bulk_edit/"
 | 
					 | 
				
			||||||
        method: POST
 | 
					 | 
				
			||||||
        body_format: json
 | 
					 | 
				
			||||||
        body:
 | 
					 | 
				
			||||||
          documents: ["{{ index }}"]
 | 
					 | 
				
			||||||
          method: delete
 | 
					 | 
				
			||||||
          parameters: {}
 | 
					 | 
				
			||||||
        headers:
 | 
					 | 
				
			||||||
          Authorization: 'Basic {{ (paperlessng_superuser_name + ":" + paperlessng_superuser_password) | b64encode }}'
 | 
					 | 
				
			||||||
      register: delete_document
 | 
					 | 
				
			||||||
      failed_when: "'OK' not in delete_document.json['result']"
 | 
					 | 
				
			||||||
@ -1,6 +0,0 @@
 | 
				
			|||||||
---
 | 
					 | 
				
			||||||
- name: extract paperless-ng
 | 
					 | 
				
			||||||
  unarchive:
 | 
					 | 
				
			||||||
    src: "https://github.com/jonaswinkler/paperless-ng/releases/download/ng-{{ paperlessng_version }}/paperless-ng-{{ paperlessng_version }}.tar.xz"
 | 
					 | 
				
			||||||
    remote_src: yes
 | 
					 | 
				
			||||||
    dest: "{{ tempdir.path }}"
 | 
					 | 
				
			||||||
@ -1,112 +0,0 @@
 | 
				
			|||||||
---
 | 
					 | 
				
			||||||
- name: install dev dependencies
 | 
					 | 
				
			||||||
  apt:
 | 
					 | 
				
			||||||
    pkg:
 | 
					 | 
				
			||||||
      - git
 | 
					 | 
				
			||||||
      - npm
 | 
					 | 
				
			||||||
      - gettext
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
- name: create output directories
 | 
					 | 
				
			||||||
  file:
 | 
					 | 
				
			||||||
    path: "{{ item }}"
 | 
					 | 
				
			||||||
    state: directory
 | 
					 | 
				
			||||||
    owner: "{{ paperlessng_system_user }}"
 | 
					 | 
				
			||||||
    group: "{{ paperlessng_system_group }}"
 | 
					 | 
				
			||||||
    mode: "750"
 | 
					 | 
				
			||||||
  with_items:
 | 
					 | 
				
			||||||
    - "{{ tempdir.path }}/paperless-ng"
 | 
					 | 
				
			||||||
    - "{{ tempdir.path }}/paperless-ng/scripts"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
- block:
 | 
					 | 
				
			||||||
    - name: create temporary git directory
 | 
					 | 
				
			||||||
      tempfile:
 | 
					 | 
				
			||||||
        state: directory
 | 
					 | 
				
			||||||
        path: "{{ paperlessng_directory }}"
 | 
					 | 
				
			||||||
      register: gitdir
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    - name: pull paperless-ng
 | 
					 | 
				
			||||||
      git:
 | 
					 | 
				
			||||||
        repo: https://github.com/paperless-ngx/paperless-ngx.git
 | 
					 | 
				
			||||||
        dest: "{{ gitdir.path }}"
 | 
					 | 
				
			||||||
        version: "{{ paperlessng_version }}"
 | 
					 | 
				
			||||||
        refspec: "+refs/pull/*:refs/pull/*"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    - name: compile frontend
 | 
					 | 
				
			||||||
      command:
 | 
					 | 
				
			||||||
        cmd: "{{ item }}"
 | 
					 | 
				
			||||||
      args:
 | 
					 | 
				
			||||||
        chdir: "{{ gitdir.path }}/src-ui"
 | 
					 | 
				
			||||||
      failed_when: false
 | 
					 | 
				
			||||||
      with_items:
 | 
					 | 
				
			||||||
        - npm install -g @angular/cli
 | 
					 | 
				
			||||||
        - npm install
 | 
					 | 
				
			||||||
        - ./node_modules/.bin/ng build --prod
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    - name: copy application into place
 | 
					 | 
				
			||||||
      copy:
 | 
					 | 
				
			||||||
        src: "{{ gitdir.path }}/{{ item.src }}"
 | 
					 | 
				
			||||||
        remote_src: yes
 | 
					 | 
				
			||||||
        dest: "{{ tempdir.path }}/paperless-ng/{{ item.dest | default('') }}"
 | 
					 | 
				
			||||||
      with_items:
 | 
					 | 
				
			||||||
        - src: CONTRIBUTING.md
 | 
					 | 
				
			||||||
        - src: LICENSE
 | 
					 | 
				
			||||||
        - src: Pipfile
 | 
					 | 
				
			||||||
        - src: Pipfile.lock
 | 
					 | 
				
			||||||
        - src: README.md
 | 
					 | 
				
			||||||
        - src: requirements.txt
 | 
					 | 
				
			||||||
        - src: gunicorn.conf.py
 | 
					 | 
				
			||||||
        - src: paperless.conf.example
 | 
					 | 
				
			||||||
          dest: "paperless.conf"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    - name: glob all scripts
 | 
					 | 
				
			||||||
      find:
 | 
					 | 
				
			||||||
        paths: ["{{ gitdir.path }}/scripts/"]
 | 
					 | 
				
			||||||
        patterns:
 | 
					 | 
				
			||||||
          - "*.service"
 | 
					 | 
				
			||||||
          - "*.sh"
 | 
					 | 
				
			||||||
      register: glob
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    - name: copy scripts
 | 
					 | 
				
			||||||
      copy:
 | 
					 | 
				
			||||||
        src: "{{ item.path }}"
 | 
					 | 
				
			||||||
        remote_src: yes
 | 
					 | 
				
			||||||
        dest: "{{ tempdir.path }}/paperless-ng/scripts/"
 | 
					 | 
				
			||||||
      with_items:
 | 
					 | 
				
			||||||
        - "{{ glob.files }}"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    - name: copy sources
 | 
					 | 
				
			||||||
      command:
 | 
					 | 
				
			||||||
        cmd: "cp -r src/ {{ tempdir.path }}/paperless-ng/src"
 | 
					 | 
				
			||||||
      args:
 | 
					 | 
				
			||||||
        chdir: "{{ gitdir.path }}"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    - name: create paperlessng venv
 | 
					 | 
				
			||||||
      command:
 | 
					 | 
				
			||||||
        cmd: "python3 -m virtualenv {{ gitdir.path }}/.venv/ -p /usr/bin/python3"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    - name: install paperlessng requirements
 | 
					 | 
				
			||||||
      command:
 | 
					 | 
				
			||||||
        cmd: "{{ gitdir.path }}/.venv/bin/python3 -m pip install -r {{ gitdir.path }}/requirements.txt"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    - name: compile messages
 | 
					 | 
				
			||||||
      command: "{{ gitdir.path }}/.venv/bin/python3 manage.py compilemessages"
 | 
					 | 
				
			||||||
      args:
 | 
					 | 
				
			||||||
        chdir: "{{ tempdir.path }}/paperless-ng/src/"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    - name: collect static files
 | 
					 | 
				
			||||||
      command: "{{ gitdir.path }}/.venv/bin/python3 manage.py collectstatic --no-input"
 | 
					 | 
				
			||||||
      args:
 | 
					 | 
				
			||||||
        chdir: "{{ tempdir.path }}/paperless-ng/src/"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    - name: remove pycache directories
 | 
					 | 
				
			||||||
      shell: find . -name __pycache__ | xargs rm -r
 | 
					 | 
				
			||||||
      args:
 | 
					 | 
				
			||||||
        chdir: "{{ tempdir.path }}"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    - name: remove temporary git directory
 | 
					 | 
				
			||||||
      file:
 | 
					 | 
				
			||||||
        path: "{{ gitdir.path }}"
 | 
					 | 
				
			||||||
        state: absent
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  become: yes
 | 
					 | 
				
			||||||
  become_user: "{{ paperlessng_system_user }}"
 | 
					 | 
				
			||||||
@ -1,559 +0,0 @@
 | 
				
			|||||||
---
 | 
					 | 
				
			||||||
- name: verify operating system
 | 
					 | 
				
			||||||
  fail:
 | 
					 | 
				
			||||||
    msg: Sorry, only Debian and Ubuntu supported at the moment.
 | 
					 | 
				
			||||||
  when: not(ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu')
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
- name: install base dependencies
 | 
					 | 
				
			||||||
  apt:
 | 
					 | 
				
			||||||
    update_cache: yes
 | 
					 | 
				
			||||||
    pkg:
 | 
					 | 
				
			||||||
      # paperless-ng
 | 
					 | 
				
			||||||
      - python3-pip
 | 
					 | 
				
			||||||
      - python3-dev
 | 
					 | 
				
			||||||
      - fonts-liberation
 | 
					 | 
				
			||||||
      - imagemagick
 | 
					 | 
				
			||||||
      - optipng
 | 
					 | 
				
			||||||
      - gnupg
 | 
					 | 
				
			||||||
      - libpq-dev
 | 
					 | 
				
			||||||
      - libmagic-dev
 | 
					 | 
				
			||||||
      - mime-support
 | 
					 | 
				
			||||||
      # OCRmyPDF
 | 
					 | 
				
			||||||
      - unpaper
 | 
					 | 
				
			||||||
      - ghostscript
 | 
					 | 
				
			||||||
      - icc-profiles-free
 | 
					 | 
				
			||||||
      - qpdf
 | 
					 | 
				
			||||||
      - liblept5
 | 
					 | 
				
			||||||
      - libxml2
 | 
					 | 
				
			||||||
      - pngquant
 | 
					 | 
				
			||||||
      - zlib1g
 | 
					 | 
				
			||||||
      - tesseract-ocr
 | 
					 | 
				
			||||||
      # dev
 | 
					 | 
				
			||||||
      - sudo
 | 
					 | 
				
			||||||
      - build-essential
 | 
					 | 
				
			||||||
      - python3-setuptools
 | 
					 | 
				
			||||||
      - python3-wheel
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# upstream virtualenv in Ubuntu 20.04 is broken
 | 
					 | 
				
			||||||
# https://github.com/pypa/virtualenv/issues/1873
 | 
					 | 
				
			||||||
- name: install python virtualenv
 | 
					 | 
				
			||||||
  pip:
 | 
					 | 
				
			||||||
    name: virtualenv
 | 
					 | 
				
			||||||
    extra_args: --upgrade
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
- name: install ocr languages
 | 
					 | 
				
			||||||
  apt:
 | 
					 | 
				
			||||||
    pkg: "{{ paperlessng_ocr_languages | map('regex_replace', '^(.*)$', 'tesseract-ocr-\\1') | map('replace', '_', '-') | list }}"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
- name: set up notesalexp repository key (for jbig2enc)
 | 
					 | 
				
			||||||
  apt_key:
 | 
					 | 
				
			||||||
    url: https://notesalexp.org/debian/alexp_key.asc
 | 
					 | 
				
			||||||
    state: present
 | 
					 | 
				
			||||||
  when: paperlessng_use_jbig2enc
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
- name: set up notesalexp repository (for jbig2enc)
 | 
					 | 
				
			||||||
  apt_repository:
 | 
					 | 
				
			||||||
    repo: "deb https://notesalexp.org/debian/{{ ansible_distribution_release }}/ {{ ansible_distribution_release }} main"
 | 
					 | 
				
			||||||
    state: present
 | 
					 | 
				
			||||||
  when: paperlessng_use_jbig2enc
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
- name: set up notesalexp repository pinning
 | 
					 | 
				
			||||||
  copy:
 | 
					 | 
				
			||||||
    content: |
 | 
					 | 
				
			||||||
      Package: *
 | 
					 | 
				
			||||||
      Pin: release o=notesalexp.org
 | 
					 | 
				
			||||||
      Pin-Priority: 1
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      Package: jbig2enc
 | 
					 | 
				
			||||||
      Pin: release o=notesalexp.org
 | 
					 | 
				
			||||||
      Pin-Priority: 500
 | 
					 | 
				
			||||||
    dest: /etc/apt/preferences.d/notesalexp
 | 
					 | 
				
			||||||
  when: paperlessng_use_jbig2enc
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
- name: install jbig2enc
 | 
					 | 
				
			||||||
  apt:
 | 
					 | 
				
			||||||
    pkg: jbig2enc
 | 
					 | 
				
			||||||
    update_cache: yes
 | 
					 | 
				
			||||||
  when: paperlessng_use_jbig2enc
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
- name: install redis
 | 
					 | 
				
			||||||
  apt:
 | 
					 | 
				
			||||||
    pkg: redis-server
 | 
					 | 
				
			||||||
  when: paperlessng_redis_host == 'localhost' or paperlessng_redis_host == '127.0.0.1'
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
- name: enable redis
 | 
					 | 
				
			||||||
  systemd:
 | 
					 | 
				
			||||||
    name: redis-server
 | 
					 | 
				
			||||||
    enabled: yes
 | 
					 | 
				
			||||||
    masked: no
 | 
					 | 
				
			||||||
    state: started
 | 
					 | 
				
			||||||
  when: paperlessng_redis_host == 'localhost' or paperlessng_redis_host == '127.0.0.1'
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
- name: create paperless system group
 | 
					 | 
				
			||||||
  group:
 | 
					 | 
				
			||||||
    name: "{{ paperlessng_system_group }}"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
- name: create paperless system user
 | 
					 | 
				
			||||||
  user:
 | 
					 | 
				
			||||||
    name: "{{ paperlessng_system_user }}"
 | 
					 | 
				
			||||||
    groups:
 | 
					 | 
				
			||||||
      - "{{ paperlessng_system_group }}"
 | 
					 | 
				
			||||||
    shell: /usr/sbin/nologin
 | 
					 | 
				
			||||||
    # GNUPG_HOME required due to paperless db.py
 | 
					 | 
				
			||||||
    create_home: yes
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
- block:
 | 
					 | 
				
			||||||
    - name: get latest release version
 | 
					 | 
				
			||||||
      uri:
 | 
					 | 
				
			||||||
        url: https://api.github.com/repos/jonaswinkler/paperless-ng/releases/latest
 | 
					 | 
				
			||||||
        method: GET
 | 
					 | 
				
			||||||
      register: latest_release
 | 
					 | 
				
			||||||
    - name: parse latest release version
 | 
					 | 
				
			||||||
      set_fact:
 | 
					 | 
				
			||||||
        paperlessng_version: "{{ latest_release.json['tag_name'] }}"
 | 
					 | 
				
			||||||
  when: paperlessng_version == "latest"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
- name: check if version is ref
 | 
					 | 
				
			||||||
  fail:
 | 
					 | 
				
			||||||
    msg: "Specifying `paperlessng_version` as git ref may not work as expected!"
 | 
					 | 
				
			||||||
  ignore_errors: True  # Output failure (as warning), but don't consider play failed
 | 
					 | 
				
			||||||
  when: paperlessng_version.startswith('refs/')
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
- block:
 | 
					 | 
				
			||||||
    - name: sanitize version string
 | 
					 | 
				
			||||||
      set_fact:
 | 
					 | 
				
			||||||
        paperlessng_version: "{{ paperlessng_version | regex_replace('^ng-(\\d+\\.\\d+\\.\\d+)$', '\\1') }}"
 | 
					 | 
				
			||||||
    - name: get tag data
 | 
					 | 
				
			||||||
      uri:
 | 
					 | 
				
			||||||
        url: https://api.github.com/repos/jonaswinkler/paperless-ng/tags
 | 
					 | 
				
			||||||
        method: GET
 | 
					 | 
				
			||||||
      register: tags
 | 
					 | 
				
			||||||
    - name: get commit for target tag
 | 
					 | 
				
			||||||
      set_fact:
 | 
					 | 
				
			||||||
        paperlessng_commit: "{{ tags.json | json_query('[?name==`ng-' + paperlessng_version +'`] | [0].commit.sha') }}"
 | 
					 | 
				
			||||||
  when: paperlessng_version | regex_search("^(ng-)?(\d+\.\d+\.\d+)$")
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
- block:
 | 
					 | 
				
			||||||
    - name: check if version is branch
 | 
					 | 
				
			||||||
      uri:
 | 
					 | 
				
			||||||
        url: "https://api.github.com/repos/jonaswinkler/paperless-ng/branches/{{ paperlessng_version }}"
 | 
					 | 
				
			||||||
        method: GET
 | 
					 | 
				
			||||||
        status_code: [200, 404]
 | 
					 | 
				
			||||||
      register: branch
 | 
					 | 
				
			||||||
    - name: get commit for target branch
 | 
					 | 
				
			||||||
      set_fact:
 | 
					 | 
				
			||||||
        paperlessng_commit: "{{ branch.json | json_query('commit.sha') }}"
 | 
					 | 
				
			||||||
      when: branch.status == 200
 | 
					 | 
				
			||||||
    - block:
 | 
					 | 
				
			||||||
        - name: check if version is commit-or-ref
 | 
					 | 
				
			||||||
          uri:
 | 
					 | 
				
			||||||
            url: "https://api.github.com/repos/jonaswinkler/paperless-ng/commits/{{ paperlessng_version }}"
 | 
					 | 
				
			||||||
            method: GET
 | 
					 | 
				
			||||||
            status_code: [200, 404, 422]
 | 
					 | 
				
			||||||
          register: commit
 | 
					 | 
				
			||||||
        - name: get commit for target commit-or-ref
 | 
					 | 
				
			||||||
          set_fact:
 | 
					 | 
				
			||||||
            paperlessng_commit: "{{ commit.json | json_query('sha') }}"
 | 
					 | 
				
			||||||
          when: commit.status == 200
 | 
					 | 
				
			||||||
        - name: fail
 | 
					 | 
				
			||||||
          fail:
 | 
					 | 
				
			||||||
            msg: "Can not determine commit from `paperlessng_version=={{ paperlessng_version }}`!"
 | 
					 | 
				
			||||||
          when: commit.status != 200
 | 
					 | 
				
			||||||
      when: branch.status == 404
 | 
					 | 
				
			||||||
  when: not(paperlessng_version | regex_search("^(ng-)?(\d+\.\d+\.\d+)$"))
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
- name: check for paperless-ng installation
 | 
					 | 
				
			||||||
  command:
 | 
					 | 
				
			||||||
    cmd: "cat {{ paperlessng_directory }}/.installed_version"
 | 
					 | 
				
			||||||
  changed_when: '"No such file or directory" in paperlessng_current_commit.stderr or paperlessng_current_commit.stdout != paperlessng_commit | string'
 | 
					 | 
				
			||||||
  failed_when: false
 | 
					 | 
				
			||||||
  ignore_errors: yes
 | 
					 | 
				
			||||||
  register: paperlessng_current_commit
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
- name: register current state
 | 
					 | 
				
			||||||
  set_fact:
 | 
					 | 
				
			||||||
    fresh_installation: '{{ "No such file or directory" in paperlessng_current_commit.stderr }}'
 | 
					 | 
				
			||||||
    update_installation: '{{ "No such file or directory" not in paperlessng_current_commit.stderr and paperlessng_current_commit.stdout != paperlessng_commit | string }}'
 | 
					 | 
				
			||||||
    reconfigure_only: "{{ paperlessng_current_commit.stdout == paperlessng_commit | string }}"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
- block:
 | 
					 | 
				
			||||||
    - name: backup current paperless-ng installation
 | 
					 | 
				
			||||||
      copy:
 | 
					 | 
				
			||||||
        src: "{{ paperlessng_directory }}"
 | 
					 | 
				
			||||||
        remote_src: yes
 | 
					 | 
				
			||||||
        dest: "{{ paperlessng_directory }}-{{ ansible_date_time.iso8601 }}/"
 | 
					 | 
				
			||||||
    - name: remove current paperless sources
 | 
					 | 
				
			||||||
      file:
 | 
					 | 
				
			||||||
        path: "{{ paperlessng_directory }}/{{ item }}"
 | 
					 | 
				
			||||||
        state: absent
 | 
					 | 
				
			||||||
      with_items:
 | 
					 | 
				
			||||||
        - docker
 | 
					 | 
				
			||||||
        - docs
 | 
					 | 
				
			||||||
        - scripts
 | 
					 | 
				
			||||||
        - src
 | 
					 | 
				
			||||||
        - static
 | 
					 | 
				
			||||||
  when: update_installation
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
- block:
 | 
					 | 
				
			||||||
    - name: create paperless-ng directory and set permissions
 | 
					 | 
				
			||||||
      file:
 | 
					 | 
				
			||||||
        path: "{{ paperlessng_directory }}"
 | 
					 | 
				
			||||||
        state: directory
 | 
					 | 
				
			||||||
        owner: "{{ paperlessng_system_user }}"
 | 
					 | 
				
			||||||
        group: "{{ paperlessng_system_group }}"
 | 
					 | 
				
			||||||
        mode: "750"
 | 
					 | 
				
			||||||
    - name: create temporary directory
 | 
					 | 
				
			||||||
      become: yes
 | 
					 | 
				
			||||||
      become_user: "{{ paperlessng_system_user }}"
 | 
					 | 
				
			||||||
      tempfile:
 | 
					 | 
				
			||||||
        state: directory
 | 
					 | 
				
			||||||
        path: "{{ paperlessng_directory }}"
 | 
					 | 
				
			||||||
      register: tempdir
 | 
					 | 
				
			||||||
    - name: check if version is available as release archive
 | 
					 | 
				
			||||||
      uri:
 | 
					 | 
				
			||||||
        url: "https://github.com/jonaswinkler/paperless-ng/releases/download/ng-{{ paperlessng_version }}/paperless-ng-{{ paperlessng_version }}.tar.xz"
 | 
					 | 
				
			||||||
        method: GET
 | 
					 | 
				
			||||||
        status_code: [200, 404]
 | 
					 | 
				
			||||||
      register: release_archive
 | 
					 | 
				
			||||||
    - name: install paperless-ng from source
 | 
					 | 
				
			||||||
      include_tasks: install-source.yml
 | 
					 | 
				
			||||||
      when: release_archive.status == 404
 | 
					 | 
				
			||||||
    - name: install paperless-ng from release archive
 | 
					 | 
				
			||||||
      include_tasks: install-release.yml
 | 
					 | 
				
			||||||
      when: release_archive.status == 200
 | 
					 | 
				
			||||||
    - name: change owner and permissions of paperless-ng
 | 
					 | 
				
			||||||
      command:
 | 
					 | 
				
			||||||
        cmd: "{{ item }}"
 | 
					 | 
				
			||||||
        warn: false
 | 
					 | 
				
			||||||
      with_items:
 | 
					 | 
				
			||||||
        - "chown -R {{ paperlessng_system_user }}:{{ paperlessng_system_group }} {{ tempdir.path }}"
 | 
					 | 
				
			||||||
        - "find {{ tempdir.path }} -type d -exec chmod 0750 {} ;"
 | 
					 | 
				
			||||||
        - "find {{ tempdir.path }} -type f -exec chmod 0640 {} ;"
 | 
					 | 
				
			||||||
    - name: move paperless-ng
 | 
					 | 
				
			||||||
      command:
 | 
					 | 
				
			||||||
        cmd: "cp -a {{ tempdir.path }}/paperless-ng/. {{ paperlessng_directory }}"
 | 
					 | 
				
			||||||
    - name: store commit hash of installed version
 | 
					 | 
				
			||||||
      copy:
 | 
					 | 
				
			||||||
        content: "{{ paperlessng_commit }}"
 | 
					 | 
				
			||||||
        dest: "{{ paperlessng_directory }}/.installed_version"
 | 
					 | 
				
			||||||
        owner: "{{ paperlessng_system_user }}"
 | 
					 | 
				
			||||||
        group: "{{ paperlessng_system_group }}"
 | 
					 | 
				
			||||||
        mode: "0440"
 | 
					 | 
				
			||||||
    - name: remove temporary directory
 | 
					 | 
				
			||||||
      file:
 | 
					 | 
				
			||||||
        path: "{{ tempdir.path }}"
 | 
					 | 
				
			||||||
        state: absent
 | 
					 | 
				
			||||||
  when: not reconfigure_only
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
- name: create paperless-ng directories and set permissions
 | 
					 | 
				
			||||||
  file:
 | 
					 | 
				
			||||||
    path: "{{ item }}"
 | 
					 | 
				
			||||||
    state: directory
 | 
					 | 
				
			||||||
    owner: "{{ paperlessng_system_user }}"
 | 
					 | 
				
			||||||
    group: "{{ paperlessng_system_group }}"
 | 
					 | 
				
			||||||
    mode: "750"
 | 
					 | 
				
			||||||
  when: item
 | 
					 | 
				
			||||||
  with_items:
 | 
					 | 
				
			||||||
    - "{{ paperlessng_consumption_dir }}"
 | 
					 | 
				
			||||||
    - "{{ paperlessng_data_dir }}"
 | 
					 | 
				
			||||||
    - "{{ paperlessng_trash_dir }}"
 | 
					 | 
				
			||||||
    - "{{ paperlessng_media_root }}"
 | 
					 | 
				
			||||||
    - "{{ paperlessng_staticdir }}"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
- name: rename initial config
 | 
					 | 
				
			||||||
  command:
 | 
					 | 
				
			||||||
    cmd: "mv -f {{ paperlessng_directory }}/paperless.conf {{ paperlessng_directory }}/paperless.conf.template"
 | 
					 | 
				
			||||||
    removes: "{{ paperlessng_directory }}/paperless.conf"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
- name: configure paperless-ng
 | 
					 | 
				
			||||||
  lineinfile:
 | 
					 | 
				
			||||||
    path: "{{ paperlessng_directory }}/paperless.conf.template"
 | 
					 | 
				
			||||||
    regexp: "^#?{{ item.regexp }}="
 | 
					 | 
				
			||||||
    line: "{{ item.line }}"
 | 
					 | 
				
			||||||
  with_items:
 | 
					 | 
				
			||||||
    # Required services
 | 
					 | 
				
			||||||
    - regexp: PAPERLESS_REDIS
 | 
					 | 
				
			||||||
      line: "PAPERLESS_REDIS=redis://{{ paperlessng_redis_host }}:{{ paperlessng_redis_port }}"
 | 
					 | 
				
			||||||
    # Paths and folders
 | 
					 | 
				
			||||||
    - regexp: PAPERLESS_CONSUMPTION_DIR
 | 
					 | 
				
			||||||
      line: "PAPERLESS_CONSUMPTION_DIR={{ paperlessng_consumption_dir }}"
 | 
					 | 
				
			||||||
    - regexp: PAPERLESS_DATA_DIR
 | 
					 | 
				
			||||||
      line: "PAPERLESS_DATA_DIR={{ paperlessng_data_dir }}"
 | 
					 | 
				
			||||||
    - regexp: PAPERLESS_TRASH_DIR
 | 
					 | 
				
			||||||
      line: "PAPERLESS_TRASH_DIR={{ paperlessng_trash_dir }}"
 | 
					 | 
				
			||||||
    - regexp: PAPERLESS_MEDIA_ROOT
 | 
					 | 
				
			||||||
      line: "PAPERLESS_MEDIA_ROOT={{ paperlessng_media_root }}"
 | 
					 | 
				
			||||||
    - regexp: PAPERLESS_STATICDIR
 | 
					 | 
				
			||||||
      line: "PAPERLESS_STATICDIR={{ paperlessng_staticdir }}"
 | 
					 | 
				
			||||||
    - regexp: PAPERLESS_FILENAME_FORMAT
 | 
					 | 
				
			||||||
      line: "PAPERLESS_FILENAME_FORMAT={{ paperlessng_filename_format }}"
 | 
					 | 
				
			||||||
    - regexp: PAPERLESS_LOGGING_DIR
 | 
					 | 
				
			||||||
      line: "PAPERLESS_LOGGING_DIR={{ paperlessng_logging_dir }}"
 | 
					 | 
				
			||||||
    # Hosting & Security
 | 
					 | 
				
			||||||
    - regexp: PAPERLESS_SECRET_KEY
 | 
					 | 
				
			||||||
      line: "PAPERLESS_SECRET_KEY={{ paperlessng_secret_key }}"
 | 
					 | 
				
			||||||
    - regexp: PAPERLESS_ALLOWED_HOSTS
 | 
					 | 
				
			||||||
      line: "PAPERLESS_ALLOWED_HOSTS={{ paperlessng_allowed_hosts }}"
 | 
					 | 
				
			||||||
    - regexp: PAPERLESS_CORS_ALLOWED_HOSTS
 | 
					 | 
				
			||||||
      line: "PAPERLESS_CORS_ALLOWED_HOSTS={{ paperlessng_cors_allowed_hosts }}"
 | 
					 | 
				
			||||||
    - regexp: PAPERLESS_FORCE_SCRIPT_NAME
 | 
					 | 
				
			||||||
      line: "PAPERLESS_FORCE_SCRIPT_NAME={{ paperlessng_force_script_name }}"
 | 
					 | 
				
			||||||
    - regexp: PAPERLESS_STATIC_URL
 | 
					 | 
				
			||||||
      line: "PAPERLESS_STATIC_URL={{ paperlessng_static_url }}"
 | 
					 | 
				
			||||||
    - regexp: PAPERLESS_AUTO_LOGIN_USERNAME
 | 
					 | 
				
			||||||
      line: "PAPERLESS_AUTO_LOGIN_USERNAME={{ paperlessng_auto_login_username }}"
 | 
					 | 
				
			||||||
    - regexp: PAPERLESS_COOKIE_PREFIX
 | 
					 | 
				
			||||||
      line: "PAPERLESS_COOKIE_PREFIX={{ paperlessng_cookie_prefix }}"
 | 
					 | 
				
			||||||
    - regexp: PAPERLESS_ENABLE_HTTP_REMOTE_USER
 | 
					 | 
				
			||||||
      line: "PAPERLESS_ENABLE_HTTP_REMOTE_USER={{ paperlessng_enable_http_remote_user }}"
 | 
					 | 
				
			||||||
    # OCR settings
 | 
					 | 
				
			||||||
    - regexp: PAPERLESS_OCR_LANGUAGE
 | 
					 | 
				
			||||||
      line: "PAPERLESS_OCR_LANGUAGE={{ paperlessng_ocr_languages | join('+') | replace('-','_') }}"
 | 
					 | 
				
			||||||
    - regexp: PAPERLESS_OCR_MODE
 | 
					 | 
				
			||||||
      line: "PAPERLESS_OCR_MODE={{ paperlessng_ocr_mode }}"
 | 
					 | 
				
			||||||
    - regexp: PAPERLESS_OCR_CLEAN
 | 
					 | 
				
			||||||
      line: "PAPERLESS_OCR_CLEAN={{ paperlessng_ocr_clean }}"
 | 
					 | 
				
			||||||
    - regexp: PAPERLESS_OCR_DESKEW
 | 
					 | 
				
			||||||
      line: "PAPERLESS_OCR_DESKEW={{ paperlessng_ocr_deskew }}"
 | 
					 | 
				
			||||||
    - regexp: PAPERLESS_OCR_ROTATE_PAGES
 | 
					 | 
				
			||||||
      line: "PAPERLESS_OCR_ROTATE_PAGES={{ paperlessng_ocr_rotate_pages }}"
 | 
					 | 
				
			||||||
    - regexp: PAPERLESS_OCR_ROTATE_PAGES_THRESHOLD
 | 
					 | 
				
			||||||
      line: "PAPERLESS_OCR_ROTATE_PAGES_THRESHOLD={{ paperlessng_ocr_rotate_pages_threshold }}"
 | 
					 | 
				
			||||||
    - regexp: PAPERLESS_OCR_OUTPUT_TYPE
 | 
					 | 
				
			||||||
      line: "PAPERLESS_OCR_OUTPUT_TYPE={{ paperlessng_ocr_output_type }}"
 | 
					 | 
				
			||||||
    - regexp: PAPERLESS_OCR_PAGES
 | 
					 | 
				
			||||||
      line: "PAPERLESS_OCR_PAGES={{ paperlessng_ocr_pages }}"
 | 
					 | 
				
			||||||
    - regexp: PAPERLESS_OCR_IMAGE_DPI
 | 
					 | 
				
			||||||
      line: "PAPERLESS_OCR_IMAGE_DPI={{ paperlessng_ocr_image_dpi }}"
 | 
					 | 
				
			||||||
    - regexp: PAPERLESS_OCR_USER_ARGS
 | 
					 | 
				
			||||||
      line: "PAPERLESS_OCR_USER_ARGS={{ paperlessng_ocr_user_args | combine({'jbig2_lossy': true} if paperlessng_big2enc_lossy else {}) | to_json }}"
 | 
					 | 
				
			||||||
    # Tika settings
 | 
					 | 
				
			||||||
    - regexp: PAPERLESS_TIKA_ENABLED
 | 
					 | 
				
			||||||
      line: "PAPERLESS_TIKA_ENABLED={{ paperlessng_tika_enabled }}"
 | 
					 | 
				
			||||||
    - regexp: PAPERLESS_TIKA_ENDPOINT
 | 
					 | 
				
			||||||
      line: "PAPERLESS_TIKA_ENDPOINT={{ paperlessng_tika_endpoint }}"
 | 
					 | 
				
			||||||
    - regexp: PAPERLESS_TIKA_GOTENBERG_ENDPOINT
 | 
					 | 
				
			||||||
      line: "PAPERLESS_TIKA_GOTENBERG_ENDPOINT={{ paperlessng_tika_gotenberg_endpoint }}"
 | 
					 | 
				
			||||||
    # Software tweaks
 | 
					 | 
				
			||||||
    - regexp: PAPERLESS_TIME_ZONE
 | 
					 | 
				
			||||||
      line: "PAPERLESS_TIME_ZONE={{ paperlessng_time_zone }}"
 | 
					 | 
				
			||||||
    - regexp: PAPERLESS_CONSUMER_POLLING
 | 
					 | 
				
			||||||
      line: "PAPERLESS_CONSUMER_POLLING={{ paperlessng_consumer_polling }}"
 | 
					 | 
				
			||||||
    - regexp: PAPERLESS_CONSUMER_DELETE_DUPLICATES
 | 
					 | 
				
			||||||
      line: "PAPERLESS_CONSUMER_DELETE_DUPLICATES={{ paperlessng_consumer_delete_duplicates }}"
 | 
					 | 
				
			||||||
    - regexp: PAPERLESS_CONSUMER_RECURSIVE
 | 
					 | 
				
			||||||
      line: "PAPERLESS_CONSUMER_RECURSIVE={{ paperlessng_consumer_recursive }}"
 | 
					 | 
				
			||||||
    - regexp: PAPERLESS_CONSUMER_SUBDIRS_AS_TAGS
 | 
					 | 
				
			||||||
      line: "PAPERLESS_CONSUMER_SUBDIRS_AS_TAGS={{ paperlessng_consumer_subdirs_as_tags }}"
 | 
					 | 
				
			||||||
    - regexp: PAPERLESS_CONVERT_MEMORY_LIMIT
 | 
					 | 
				
			||||||
      line: "PAPERLESS_CONVERT_MEMORY_LIMIT={{ paperlessng_convert_memory_limit }}"
 | 
					 | 
				
			||||||
    - regexp: PAPERLESS_CONVERT_TMPDIR
 | 
					 | 
				
			||||||
      line: "PAPERLESS_CONVERT_TMPDIR={{ paperlessng_convert_tmpdir }}"
 | 
					 | 
				
			||||||
    - regexp: PAPERLESS_OPTIMIZE_THUMBNAILS
 | 
					 | 
				
			||||||
      line: "PAPERLESS_OPTIMIZE_THUMBNAILS={{ paperlessng_optimize_thumbnails }}"
 | 
					 | 
				
			||||||
    - regexp: PAPERLESS_PRE_CONSUME_SCRIPT
 | 
					 | 
				
			||||||
      line: "PAPERLESS_PRE_CONSUME_SCRIPT={{ paperlessng_pre_consume_script }}"
 | 
					 | 
				
			||||||
    - regexp: PAPERLESS_POST_CONSUME_SCRIPT
 | 
					 | 
				
			||||||
      line: "PAPERLESS_POST_CONSUME_SCRIPT={{ paperlessng_post_consume_script }}"
 | 
					 | 
				
			||||||
    - regexp: PAPERLESS_FILENAME_DATE_ORDER
 | 
					 | 
				
			||||||
      line: "PAPERLESS_FILENAME_DATE_ORDER={{ paperlessng_filename_date_order }}"
 | 
					 | 
				
			||||||
    - regexp: PAPERLESS_THUMBNAIL_FONT_NAME
 | 
					 | 
				
			||||||
      line: "PAPERLESS_THUMBNAIL_FONT_NAME={{ paperlessng_thumbnail_font_name }}"
 | 
					 | 
				
			||||||
    - regexp: PAPERLESS_IGNORE_DATES
 | 
					 | 
				
			||||||
      line: "PAPERLESS_IGNORE_DATES={{ paperlessng_ignore_dates }}"
 | 
					 | 
				
			||||||
  no_log: yes
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
- name: configure paperless-ng database [sqlite]
 | 
					 | 
				
			||||||
  lineinfile:
 | 
					 | 
				
			||||||
    path: "{{ paperlessng_directory }}/paperless.conf.template"
 | 
					 | 
				
			||||||
    regexp: "^#?PAPERLESS_DBHOST=(.*)$"
 | 
					 | 
				
			||||||
    line: '#PAPERLESS_DBHOST=\1'
 | 
					 | 
				
			||||||
    backrefs: yes
 | 
					 | 
				
			||||||
  when: paperlessng_db_type == 'sqlite'
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
- name: configure paperless-ng database [postgresql]
 | 
					 | 
				
			||||||
  lineinfile:
 | 
					 | 
				
			||||||
    path: "{{ paperlessng_directory }}/paperless.conf.template"
 | 
					 | 
				
			||||||
    regexp: "^#?{{ item.regexp }}="
 | 
					 | 
				
			||||||
    line: "{{ item.line }}"
 | 
					 | 
				
			||||||
  with_items:
 | 
					 | 
				
			||||||
    - regexp: PAPERLESS_DBHOST
 | 
					 | 
				
			||||||
      line: "PAPERLESS_DBHOST={{ paperlessng_db_host }}"
 | 
					 | 
				
			||||||
    - regexp: PAPERLESS_DBPORT
 | 
					 | 
				
			||||||
      line: "PAPERLESS_DBPORT={{ paperlessng_db_port }}"
 | 
					 | 
				
			||||||
    - regexp: PAPERLESS_DBNAME
 | 
					 | 
				
			||||||
      line: "PAPERLESS_DBNAME={{ paperlessng_db_name }}"
 | 
					 | 
				
			||||||
    - regexp: PAPERLESS_DBUSER
 | 
					 | 
				
			||||||
      line: "PAPERLESS_DBUSER={{ paperlessng_db_user }}"
 | 
					 | 
				
			||||||
    - regexp: PAPERLESS_DBPASS
 | 
					 | 
				
			||||||
      line: "PAPERLESS_DBPASS={{ paperlessng_db_pass }}"
 | 
					 | 
				
			||||||
    - regexp: PAPERLESS_DBSSLMODE
 | 
					 | 
				
			||||||
      line: "PAPERLESS_DBSSLMODE={{ paperlessng_db_sslmode }}"
 | 
					 | 
				
			||||||
  when: paperlessng_db_type == 'postgresql'
 | 
					 | 
				
			||||||
  no_log: yes
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
- name: deploy paperless-ng configuration
 | 
					 | 
				
			||||||
  copy:
 | 
					 | 
				
			||||||
    src: "{{ paperlessng_directory }}/paperless.conf.template"
 | 
					 | 
				
			||||||
    remote_src: yes
 | 
					 | 
				
			||||||
    dest: /etc/paperless.conf
 | 
					 | 
				
			||||||
    owner: root
 | 
					 | 
				
			||||||
    group: root
 | 
					 | 
				
			||||||
    mode: "0644"
 | 
					 | 
				
			||||||
  register: configuration
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
- name: create paperlessng venv
 | 
					 | 
				
			||||||
  become: yes
 | 
					 | 
				
			||||||
  become_user: "{{ paperlessng_system_user }}"
 | 
					 | 
				
			||||||
  command:
 | 
					 | 
				
			||||||
    cmd: "python3 -m virtualenv {{ paperlessng_virtualenv }} -p /usr/bin/python3"
 | 
					 | 
				
			||||||
    creates: "{{ paperlessng_virtualenv }}"
 | 
					 | 
				
			||||||
  register: venv
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
- block:
 | 
					 | 
				
			||||||
    - name: install paperlessng requirements
 | 
					 | 
				
			||||||
      become: yes
 | 
					 | 
				
			||||||
      become_user: "{{ paperlessng_system_user }}"
 | 
					 | 
				
			||||||
      pip:
 | 
					 | 
				
			||||||
        requirements: "{{ paperlessng_directory }}/requirements.txt"
 | 
					 | 
				
			||||||
        executable: "{{ paperlessng_virtualenv }}/bin/pip3"
 | 
					 | 
				
			||||||
        extra_args: --upgrade
 | 
					 | 
				
			||||||
    - name: migrate database schema
 | 
					 | 
				
			||||||
      become: yes
 | 
					 | 
				
			||||||
      become_user: "{{ paperlessng_system_user }}"
 | 
					 | 
				
			||||||
      command: "{{ paperlessng_virtualenv }}/bin/python3 {{ paperlessng_directory }}/src/manage.py migrate"
 | 
					 | 
				
			||||||
      register: database_schema
 | 
					 | 
				
			||||||
      changed_when: '"No migrations to apply." not in database_schema.stdout'
 | 
					 | 
				
			||||||
  when: not reconfigure_only
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
- name: configure paperless superuser
 | 
					 | 
				
			||||||
  become: yes
 | 
					 | 
				
			||||||
  become_user: "{{ paperlessng_system_user }}"
 | 
					 | 
				
			||||||
  # "manage.py createsuperuser" only works on interactive TTYs
 | 
					 | 
				
			||||||
  vars:
 | 
					 | 
				
			||||||
    creation_script: |
 | 
					 | 
				
			||||||
      from django.contrib.auth.models import User
 | 
					 | 
				
			||||||
      from django.contrib.auth.hashers import get_hasher
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      if User.objects.filter(username='{{ paperlessng_superuser_name }}').exists():
 | 
					 | 
				
			||||||
          user = User.objects.get(username='{{ paperlessng_superuser_name }}')
 | 
					 | 
				
			||||||
          old = user.__dict__.copy()
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
          user.is_superuser = True
 | 
					 | 
				
			||||||
          user.email = '{{ paperlessng_superuser_email }}'
 | 
					 | 
				
			||||||
          user.set_password('{{ paperlessng_superuser_password }}')
 | 
					 | 
				
			||||||
          user.save()
 | 
					 | 
				
			||||||
          new = user.__dict__
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
          algorithm, iterations, old_salt, old_hash = old['password'].split('$')
 | 
					 | 
				
			||||||
          new_password_old_salt = get_hasher(algorithm).encode(password='{{ paperlessng_superuser_password }}', salt=old_salt, iterations=int(iterations))
 | 
					 | 
				
			||||||
          _, _, _, new_hash = new_password_old_salt.split('$')
 | 
					 | 
				
			||||||
          if not (old_hash == new_hash and old['is_superuser'] == new['is_superuser'] and old['email'] == new['email']):
 | 
					 | 
				
			||||||
              print('changed')
 | 
					 | 
				
			||||||
      else:
 | 
					 | 
				
			||||||
          User.objects.create_superuser('{{ paperlessng_superuser_name }}', '{{ paperlessng_superuser_email }}', '{{ paperlessng_superuser_password }}')
 | 
					 | 
				
			||||||
          print('changed')
 | 
					 | 
				
			||||||
  command: '{{ paperlessng_virtualenv }}/bin/python3 {{ paperlessng_directory }}/src/manage.py shell -c "{{ creation_script }}"'
 | 
					 | 
				
			||||||
  register: superuser
 | 
					 | 
				
			||||||
  changed_when: superuser.stdout == 'changed'
 | 
					 | 
				
			||||||
  no_log: yes
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
- name: set ownership and permissions on paperlessng venv
 | 
					 | 
				
			||||||
  file:
 | 
					 | 
				
			||||||
    path: "{{ paperlessng_virtualenv }}"
 | 
					 | 
				
			||||||
    state: directory
 | 
					 | 
				
			||||||
    recurse: yes
 | 
					 | 
				
			||||||
    owner: "{{ paperlessng_system_user }}"
 | 
					 | 
				
			||||||
    group: "{{ paperlessng_system_group }}"
 | 
					 | 
				
			||||||
    mode: g-w,o-rwx
 | 
					 | 
				
			||||||
  when: venv.changed or not reconfigure_only
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
- name: configure ghostscript for PDF
 | 
					 | 
				
			||||||
  lineinfile:
 | 
					 | 
				
			||||||
    path: /etc/ImageMagick-6/policy.xml
 | 
					 | 
				
			||||||
    regexp: '(\s+)<policy domain="coder" rights=".*" pattern="PDF" />'
 | 
					 | 
				
			||||||
    line: '\1<policy domain="coder" rights="read|write" pattern="PDF" />'
 | 
					 | 
				
			||||||
    backrefs: yes
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
- name: configure gunicorn web server
 | 
					 | 
				
			||||||
  lineinfile:
 | 
					 | 
				
			||||||
    path: "{{ paperlessng_directory }}/gunicorn.conf.py"
 | 
					 | 
				
			||||||
    regexp: '^bind = '
 | 
					 | 
				
			||||||
    line: "bind = '{{ paperlessng_listen_address }}:{{ paperlessng_listen_port }}'"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
- name: configure systemd services
 | 
					 | 
				
			||||||
  ini_file:
 | 
					 | 
				
			||||||
    path: "{{ paperlessng_directory }}/scripts/{{ item[0] }}"
 | 
					 | 
				
			||||||
    section: "Service"
 | 
					 | 
				
			||||||
    option: "{{ item[1].option  }}"
 | 
					 | 
				
			||||||
    value: "{{ item[1].value }}"
 | 
					 | 
				
			||||||
  with_nested:
 | 
					 | 
				
			||||||
    - [
 | 
					 | 
				
			||||||
        paperless-consumer.service,
 | 
					 | 
				
			||||||
        paperless-scheduler.service,
 | 
					 | 
				
			||||||
        paperless-webserver.service,
 | 
					 | 
				
			||||||
      ]
 | 
					 | 
				
			||||||
    - [
 | 
					 | 
				
			||||||
        # https://www.freedesktop.org/software/systemd/man/systemd.exec.html
 | 
					 | 
				
			||||||
        { option: "User", value: "{{ paperlessng_system_user }}" },
 | 
					 | 
				
			||||||
        { option: "Group", value: "{{ paperlessng_system_group }}" },
 | 
					 | 
				
			||||||
        { option: "WorkingDirectory", value: "{{ paperlessng_directory }}/src" },
 | 
					 | 
				
			||||||
        { option: "ProtectSystem", value: "full" },
 | 
					 | 
				
			||||||
        { option: "NoNewPrivileges", value: "true" },
 | 
					 | 
				
			||||||
        { option: "PrivateUsers", value: "true" },
 | 
					 | 
				
			||||||
        { option: "PrivateDevices", value: "true" },
 | 
					 | 
				
			||||||
      ]
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
- name: configure paperless-consumer service
 | 
					 | 
				
			||||||
  ini_file:
 | 
					 | 
				
			||||||
    path: "{{ paperlessng_directory }}/scripts/paperless-consumer.service"
 | 
					 | 
				
			||||||
    section: "Service"
 | 
					 | 
				
			||||||
    option: "ExecStart"
 | 
					 | 
				
			||||||
    value: "{{ paperlessng_virtualenv }}/bin/python3 manage.py document_consumer"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
- name: configure paperless-scheduler service
 | 
					 | 
				
			||||||
  ini_file:
 | 
					 | 
				
			||||||
    path: "{{ paperlessng_directory }}/scripts/paperless-scheduler.service"
 | 
					 | 
				
			||||||
    section: "Service"
 | 
					 | 
				
			||||||
    option: "ExecStart"
 | 
					 | 
				
			||||||
    value: "{{ paperlessng_virtualenv }}/bin/python3 manage.py qcluster"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
- name: configure paperless-webserver service
 | 
					 | 
				
			||||||
  ini_file:
 | 
					 | 
				
			||||||
    path: "{{ paperlessng_directory }}/scripts/paperless-webserver.service"
 | 
					 | 
				
			||||||
    section: "Service"
 | 
					 | 
				
			||||||
    option: "ExecStart"
 | 
					 | 
				
			||||||
    value: "{{ paperlessng_virtualenv }}/bin/gunicorn -c {{ paperlessng_directory }}/gunicorn.conf.py paperless.asgi:application"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
- name: copy systemd services
 | 
					 | 
				
			||||||
  copy:
 | 
					 | 
				
			||||||
    src: "{{ paperlessng_directory }}/scripts/{{ item }}"
 | 
					 | 
				
			||||||
    remote_src: yes
 | 
					 | 
				
			||||||
    dest: "/etc/systemd/system/{{ item }}"
 | 
					 | 
				
			||||||
  with_items:
 | 
					 | 
				
			||||||
    - paperless-consumer.service
 | 
					 | 
				
			||||||
    - paperless-scheduler.service
 | 
					 | 
				
			||||||
    - paperless-webserver.service
 | 
					 | 
				
			||||||
  register: paperless_services
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
- name: reload systemd daemon
 | 
					 | 
				
			||||||
  systemd:
 | 
					 | 
				
			||||||
    name: "{{ item }}"
 | 
					 | 
				
			||||||
    state: restarted
 | 
					 | 
				
			||||||
    daemon_reload: yes
 | 
					 | 
				
			||||||
  with_items:
 | 
					 | 
				
			||||||
    - paperless-consumer
 | 
					 | 
				
			||||||
    - paperless-scheduler
 | 
					 | 
				
			||||||
    - paperless-webserver
 | 
					 | 
				
			||||||
  when: paperless_services.changed or configuration.changed
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
- name: enable paperlessng services
 | 
					 | 
				
			||||||
  systemd:
 | 
					 | 
				
			||||||
    name: "{{ item }}"
 | 
					 | 
				
			||||||
    enabled: yes
 | 
					 | 
				
			||||||
    masked: no
 | 
					 | 
				
			||||||
    state: started
 | 
					 | 
				
			||||||
  with_items:
 | 
					 | 
				
			||||||
    - paperless-consumer
 | 
					 | 
				
			||||||
    - paperless-scheduler
 | 
					 | 
				
			||||||
    - paperless-webserver
 | 
					 | 
				
			||||||
@ -144,32 +144,6 @@ After grabbing the new release and unpacking the contents, do the following:
 | 
				
			|||||||
    This might not actually do anything. Not every new paperless version comes with new
 | 
					    This might not actually do anything. Not every new paperless version comes with new
 | 
				
			||||||
    database migrations.
 | 
					    database migrations.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Ansible Route
 | 
					 | 
				
			||||||
=============
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Most of the update process is automated when using the ansible role.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
1.  Update the role to the target release tag to make sure the ansible scripts are compatible:
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    .. code:: shell-session
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        $ ansible-galaxy install git+https://github.com/jonaswinkler/paperless-ng.git,master --force
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
2.  Update the role variable definitions ``vars/paperless-ng.yml`` (where appropriate).
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
3.  Run the ansible playbook you created created during :ref:`installation <setup-ansible>` again:
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    .. note::
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        When ansible detects that an update run is in progress, it backs up the entire ``paperlessng_directory`` to ``paperlessng_directory-TIMESTAMP``.
 | 
					 | 
				
			||||||
        Updates can be rolled back by simply moving the timestamped folder back to the original location.
 | 
					 | 
				
			||||||
        If the update succeeds and you want to continue using the new release, please don't forget to delete the backup folder.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    .. code:: shell-session
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        $ ansible-playbook playbook.yml
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Downgrading Paperless
 | 
					Downgrading Paperless
 | 
				
			||||||
#####################
 | 
					#####################
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										116
									
								
								docs/setup.rst
									
									
									
									
									
								
							
							
						
						
									
										116
									
								
								docs/setup.rst
									
									
									
									
									
								
							@ -85,7 +85,6 @@ You can go multiple routes to setup and run Paperless:
 | 
				
			|||||||
* :ref:`Pull the image from Docker Hub <setup-docker_hub>`
 | 
					* :ref:`Pull the image from Docker Hub <setup-docker_hub>`
 | 
				
			||||||
* :ref:`Build the Docker image yourself <setup-docker_build>`
 | 
					* :ref:`Build the Docker image yourself <setup-docker_build>`
 | 
				
			||||||
* :ref:`Install Paperless directly on your system manually (bare metal) <setup-bare_metal>`
 | 
					* :ref:`Install Paperless directly on your system manually (bare metal) <setup-bare_metal>`
 | 
				
			||||||
* :ref:`Use ansible to install Paperless on your system automatically (bare metal) <setup-ansible>`
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
The Docker routes are quick & easy. These are the recommended routes. This configures all the stuff
 | 
					The Docker routes are quick & easy. These are the recommended routes. This configures all the stuff
 | 
				
			||||||
from the above automatically so that it just works and uses sensible defaults for all configuration options.
 | 
					from the above automatically so that it just works and uses sensible defaults for all configuration options.
 | 
				
			||||||
@ -95,12 +94,7 @@ The bare metal route is complicated to setup but makes it easier
 | 
				
			|||||||
should you want to contribute some code back. You need to configure and
 | 
					should you want to contribute some code back. You need to configure and
 | 
				
			||||||
run the above mentioned components yourself.
 | 
					run the above mentioned components yourself.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
The ansible route combines benefits of both options:
 | 
					 | 
				
			||||||
the setup process is fully automated, reproducible and `idempotent <https://docs.ansible.com/ansible/latest/reference_appendices/glossary.html#Idempotency>`_,
 | 
					 | 
				
			||||||
it includes the same sensible defaults, and it simultaneously provides the flexibility of a bare metal installation.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
.. _CLI Basics: https://www.sehn.tech/refs/devops-with-docker/
 | 
					.. _CLI Basics: https://www.sehn.tech/refs/devops-with-docker/
 | 
				
			||||||
.. _idempotent: https://docs.ansible.com/ansible/latest/reference_appendices/glossary.html#Idempotency
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
.. _setup-docker_script:
 | 
					.. _setup-docker_script:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -472,116 +466,6 @@ writing. Windows is not and will never be supported.
 | 
				
			|||||||
    to compile this by yourself, because this software has been patented until around 2017 and
 | 
					    to compile this by yourself, because this software has been patented until around 2017 and
 | 
				
			||||||
    binary packages are not available for most distributions.
 | 
					    binary packages are not available for most distributions.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.. _setup-ansible:
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Install Paperless using ansible
 | 
					 | 
				
			||||||
===============================
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
.. note::
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    This role currently only supports Debian 10 Buster and Ubuntu 20.04 Focal or later as target hosts.
 | 
					 | 
				
			||||||
		Additionally, only i386 or amd64 based hosts are supported right now, i.e. installation on arm hosts will fail.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
1.  Install ansible 2.7+ on the management node.
 | 
					 | 
				
			||||||
    This may be the target host paperless-ngx is being installed on or any remote host which can access the target host.
 | 
					 | 
				
			||||||
    For further details, check the ansible `inventory <https://docs.ansible.com/ansible/latest/user_guide/intro_inventory.html>`_ documentation.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    On Debian and Ubuntu, the official repositories should provide a suitable version:
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    .. code:: bash
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        apt install ansible
 | 
					 | 
				
			||||||
        ansible --version
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    Alternatively, you can install the most recent ansible release using PyPI:
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    .. code:: bash
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        python3 -m pip install ansible
 | 
					 | 
				
			||||||
        ansible --version
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    Make sure your taget hosts are accessible:
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    .. code:: sh
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        ansible -m ping YourAnsibleTargetHostGoesHere
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
2.  Install the latest tag of the ansible role using ansible-galaxy
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    .. code:: sh
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        ansible-galaxy install git+https://github.com/jonaswinkler/paperless-ng.git,ng-1.4.2
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
3.  Create an ansible ``playbook.yml`` in a directory of your choice:
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    .. code:: yaml
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        - hosts: YourAnsibleTargetHostGoesHere
 | 
					 | 
				
			||||||
          become: yes
 | 
					 | 
				
			||||||
          vars_files:
 | 
					 | 
				
			||||||
            - vars/paperless-ng.yml
 | 
					 | 
				
			||||||
          roles:
 | 
					 | 
				
			||||||
            - paperless-ng
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    Optional: If you also want to use PostgreSQL on the target system, install and add (for example) the `geerlingguy.postgresql <https://github.com/geerlingguy/ansible-role-postgresql>`_ role:
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    .. code:: sh
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        ansible-galaxy install geerlingguy.postgresql
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    .. code:: yaml
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        - hosts: YourAnsibleTargetHostGoesHere
 | 
					 | 
				
			||||||
          become: yes
 | 
					 | 
				
			||||||
          vars_files:
 | 
					 | 
				
			||||||
            - vars/paperless-ng.yml
 | 
					 | 
				
			||||||
          roles:
 | 
					 | 
				
			||||||
            - geerlingguy.postgresql
 | 
					 | 
				
			||||||
            - paperless-ng
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    Optional: If you also want to use a reverse proxy on the target system, install and add (for example) the `geerlingguy.nginx <https://github.com/geerlingguy/ansible-role-nginx>`_ role:
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    .. code:: sh
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        ansible-galaxy install geerlingguy.nginx
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    .. code:: yaml
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        - hosts: YourAnsibleTargetHostGoesHere
 | 
					 | 
				
			||||||
          become: yes
 | 
					 | 
				
			||||||
          vars_files:
 | 
					 | 
				
			||||||
            - vars/paperless-ng.yml
 | 
					 | 
				
			||||||
          roles:
 | 
					 | 
				
			||||||
            - geerlingguy.postgresql
 | 
					 | 
				
			||||||
            - paperless-ng
 | 
					 | 
				
			||||||
            - geerlingguy.nginx
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
4.  Create ``vars/paperless-ng.yml`` to configure your ansible deployment:
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    .. code:: yaml
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        paperlessng_secret_key: PleaseGenerateAStrongKeyForThis
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        paperlessng_superuser_name: YourUserName
 | 
					 | 
				
			||||||
        paperlessng_superuser_email: name@domain.tld
 | 
					 | 
				
			||||||
        paperlessng_superuser_password: YourDesiredPasswordUsedForFirstLogin
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        paperlessng_ocr_languages:
 | 
					 | 
				
			||||||
            - eng
 | 
					 | 
				
			||||||
            - deu
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    For all of the available options, please check ``ansible/README.md`` and :ref:`configuration`.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    Optional configurations for the above-mentioned PostgreSQL and nginx roles would also go here.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
5. Run the ansible playbook from the management node:
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    .. code:: sh
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        ansible-playbook playbook.yml
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    When this step completes successfully, paperless-ngx will be available on the target host at ``http://127.0.0.1:8000`` (or the address you configured).
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Migration to paperless-ngx
 | 
					Migration to paperless-ngx
 | 
				
			||||||
#########################
 | 
					#########################
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user