This repository has been archived by the owner on Feb 16, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 352
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #355 from C0nsultant/ansible-documentation
Ansible - Provide documentation
- Loading branch information
Showing
2 changed files
with
214 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,114 @@ | ||
Role Name | ||
========= | ||
Ansible Role: paperless-ng | ||
========================== | ||
|
||
A brief description of the role goes here. | ||
Installs and configures paperless-ng EDMS on Debian/Ubuntu systems. | ||
|
||
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. | ||
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: ansible | ||
become: yes | ||
|
||
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. | ||
Most configuration variables from paperless-ng itself are available and accept their respective arguments. | ||
Every `PAPERLESS_*` configuration varaible is lowercased and instead prefixed with `paperlessng_*` in `defaults/main.yml`. | ||
|
||
For a full listing including explainations and allowed values, see the current [documentation](https://paperless-ng.readthedocs.io/en/ng-0.9.14/configuration.html). | ||
|
||
Additional variables available in this role are listed below, along with default values: | ||
|
||
paperlessng_version: 0.9.14 | ||
|
||
The [release](https://github.com/jonaswinkler/paperless-ng/releases) archive version of paperless-ng to install. | ||
|
||
paperlessng_redis_host: localhost | ||
paperlessng_redis_port: 6379 | ||
|
||
Seperate 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: [email protected] | ||
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 | ||
------------ | ||
|
||
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. | ||
No ansible dependencies. | ||
|
||
Example Playbook | ||
---------------- | ||
`playbook.yml`: | ||
|
||
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 | ||
- hosts: all | ||
become: yes | ||
vars_files: | ||
- vars/main.yml | ||
roles: | ||
- { role: username.rolename, x: 42 } | ||
- ansible | ||
|
||
`vars/main.yml`: | ||
|
||
License | ||
------- | ||
paperlessng_media_root: /mnt/media/smbshare | ||
|
||
BSD | ||
paperlessng_db_type: postgresql | ||
paperlessng_db_pass: PLEASEPROVIDEASTRONGPASSWORDHERE | ||
|
||
Author Information | ||
------------------ | ||
paperless_secret_key: AGAINPLEASECHANGETHISNOW | ||
|
||
An optional section for the role authors to include contact information, or a website (HTML is not allowed). | ||
paperlessng_ocr_languages: | ||
- eng | ||
- deu |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -83,7 +83,8 @@ You can go multiple routes with setting up and running Paperless: | |
|
||
* :ref:`Pull the image from Docker Hub <setup-docker_hub>` | ||
* :ref:`Build the Docker image yourself <setup-docker_build>` | ||
* :ref:`Install Paperless directly on your system (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 | ||
from above automatically so that it just works and uses sensible defaults for all configuration options. | ||
|
@@ -92,6 +93,11 @@ The bare metal route is more complicated to setup but makes it easier | |
should you want to contribute some code back. You need to configure and | ||
run the above mentioned components yourself. | ||
|
||
The ansible route cobines benefits from both options: | ||
the setup process is fully automated, reproducible and idempotent, | ||
it includes the same sensible defaults, | ||
and it simultaneously provides the flexibility of a bare metal installation. | ||
|
||
.. _setup-docker_hub: | ||
|
||
Install Paperless from Docker Hub | ||
|
@@ -392,6 +398,121 @@ writing. Windows is not and will never be supported. | |
to compile this by yourself, because this software has been patented until around 2017 and | ||
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. | ||
|
||
1. Install ansible 2.7+ on the management node. | ||
This may be the target host paperless-ng 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. Clone the repository of paperless-ng: | ||
|
||
.. code:: sh | ||
git clone https://github.com/jonaswinkler/paperless-ng | ||
Checkout the latest release tag: | ||
|
||
.. code:: sh | ||
cd paperless-ng | ||
git checkout ng-0.9.14 | ||
3. Create an ansible ``playbook.yml`` in the paperless-ng root directory: | ||
|
||
.. code:: yaml | ||
- hosts: YourAnsibleTargetHostGoesHere | ||
become: yes | ||
vars_files: | ||
- ansible/vars.yml | ||
roles: | ||
- ansible | ||
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: | ||
- ansible/vars.yml | ||
roles: | ||
- geerlingguy.postgresql | ||
- ansible | ||
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: | ||
- ansible/vars.yml | ||
roles: | ||
- geerlingguy.postgresql | ||
- ansible | ||
- geerlingguy.nginx | ||
4. Create ``ansible/vars.yml`` to configure your ansible deployment: | ||
|
||
.. code:: yaml | ||
paperless_secret_key: PleaseGenerateAStrongKeyForThis | ||
paperlessng_superuser_name: YourUserName | ||
paperlessng_superuser_email: [email protected] | ||
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-ng will be available on the target host at ``http://127.0.0.1:8000`` (or the address you configured). | ||
|
||
Migration to paperless-ng | ||
######################### | ||
|
||
|