From a659a3c52a9a44e32c28d7c6ef338f80b1710c7e Mon Sep 17 00:00:00 2001 From: Laur Ivan Date: Fri, 7 Oct 2022 14:50:14 +0200 Subject: [PATCH] Add readme. Fix linting. Remove posrgresql port by default. --- README.md | 139 ++++++++++++++++++++++++++++++++++++++-------- defaults/main.yml | 2 +- tasks/main.yml | 2 +- 3 files changed, 117 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index 225dd44..79f3e91 100644 --- a/README.md +++ b/README.md @@ -1,38 +1,129 @@ -Role Name -========= +# laurivan.paperless -A brief description of the role goes here. +This role installs paperless-ngx via docker-compose. -Requirements ------------- +## 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. +You need to have a machine capable of running docker and docker-compose. -Role Variables --------------- +## 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. +This role uses the variables listed below, along with default values (see defaults/main.yml). -Dependencies ------------- +### Docker -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. +This role allows you to select versions of the various docker images used by paperless-ngx: -Example Playbook ----------------- +```yml +paperless_image_version_redis: "7" +paperless_image_version_gotenberg: "7.4" +paperless_image_version_tika: "latest" +paperless_image_version_paperless: "latest" +``` -Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: +### Ports +By default, only paperless UI is exposed: - - hosts: servers - roles: - - { role: username.rolename, x: 42 } +```yml +paperless_port: 38000 +``` -License -------- +You can expose the PostgreSQL port as well for backups via: -BSD +```yml +paperless_db_port: 5432 +``` -Author Information ------------------- +### Run as -An optional section for the role authors to include contact information, or a website (HTML is not allowed). +You can run the docker containers as a different user via: + +```yml +paperless_uid: +paperless_gid: +``` + +If these values are empty, the current ansible user is used :) + +### Credentials + +When you install paperless for the first time, you need to add a default admin user (username and password): + +```yml +paperless_admin_user: "admin" +paperless_admin_password: "changeme" +``` + +### Directories + +#### Configuration +By default, all configuration files (e.g. `docker-compose.yml`) are placed in *~/paperless*. You can change this via: + +```yml +paperless_setup_path: "~/paperless" +``` + +#### Ingestion and export + +Paplerless allows you to inport/export documents via directories: + +```yml +paperless_consumer_path: "/mnt/documents-consume" +paperless_volume_consume: "{{ paperless_consumer_path }}/consume" +paperless_volume_export: "{{ paperless_consumer_path }}/export" +``` + +#### Docker persistence + +You need to set up various volumes for data persistence. They are: + +```yml +paperless_volume_base: "/mnt/documents" +paperless_volume_media: "{{ paperless_volume_base }}/media" +paperless_volume_metadata: "{{ paperless_volume_base }}/data" +paperless_volume_redis: "{{ paperless_volume_base }}/redis" +paperless_volume_db: "{{ paperless_volume_base }}/db" +``` + +**Notes:** + +1. The `paperless_volume_base` provided for convenience as default. +2. The volumes are directory-based. If you want this role to support docker volumes, please do a pull request :) + + + +## Database + +By default, this instance is configured with PostgreSQL: + + +```yml +paperless_image_version_db: "13-alpine" +paperless_db_host: "postgres" +paperless_db_port: +paperless_db_user: "paperless" +paperless_db_password: "changeme" +``` + +If the value for `paperless_db_host` is not **postgres**, then the postgres container is not installed, and you need to provide a different DB. + + +## Dependencies + +No dependencies. + +## Example Playbook + +```yml +- hosts: servers + roles: + - laurivan.paperless +``` + +## License + +MIT + +## Author Information + +This role was created in 2022 by [Laur Ivan](https://www.laurivan.com) diff --git a/defaults/main.yml b/defaults/main.yml index 32b3847..956b5d7 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -28,6 +28,6 @@ paperless_port: 38000 paperless_image_version_db: "13-alpine" paperless_db_host: "postgres" -paperless_db_port: 5432 +paperless_db_port: paperless_db_user: "paperless" paperless_db_password: "changeme" diff --git a/tasks/main.yml b/tasks/main.yml index 9050a0a..e4181f3 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -33,7 +33,7 @@ - name: Write configuration files ansible.builtin.template: src: "{{ item }}.j2" - dest: "{{ paperless_setup_path | expanduser }}/{{ item }}" + dest: "{{ paperless_setup_path | expanduser }}/{{ item }}" mode: '0640' loop: - "docker-compose.yml"