mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-02 13:45:10 -05:00
Move paperless.conf to /etc, drop permissions
This commit is contained in:
parent
bf3ffc29a9
commit
f075384b44
@ -158,9 +158,14 @@
|
|||||||
- "{{ paperlessng_media_root }}"
|
- "{{ paperlessng_media_root }}"
|
||||||
- "{{ paperlessng_static_dir }}"
|
- "{{ paperlessng_static_dir }}"
|
||||||
|
|
||||||
|
- name: rename initial config
|
||||||
|
command:
|
||||||
|
cmd: "mv {{ paperlessng_directory }}/paperless.conf {{ paperlessng_directory }}/paperless.conf.template"
|
||||||
|
removes: "{{ paperlessng_directory }}/paperless.conf"
|
||||||
|
|
||||||
- name: configure paperless-ng
|
- name: configure paperless-ng
|
||||||
lineinfile:
|
lineinfile:
|
||||||
path: "{{ paperlessng_directory }}/paperless.conf"
|
path: "{{ paperlessng_directory }}/paperless.conf.template"
|
||||||
regexp: "{{ item.regexp }}"
|
regexp: "{{ item.regexp }}"
|
||||||
line: "{{ item.line }}"
|
line: "{{ item.line }}"
|
||||||
with_items:
|
with_items:
|
||||||
@ -184,18 +189,18 @@
|
|||||||
# line: "PAPERLESS_OCR_USER_ARG=\"{{ paperlessng_ocrmypdf_args }}{{ ' --jbig2-lossy' if paperlessng_use_jbig2enc else '' }}\""
|
# line: "PAPERLESS_OCR_USER_ARG=\"{{ paperlessng_ocrmypdf_args }}{{ ' --jbig2-lossy' if paperlessng_use_jbig2enc else '' }}\""
|
||||||
- regexp: "^#?PAPERLESS_TIME_ZONE="
|
- regexp: "^#?PAPERLESS_TIME_ZONE="
|
||||||
line: "PAPERLESS_TIME_ZONE={{ paperlessng_time_zone }}"
|
line: "PAPERLESS_TIME_ZONE={{ paperlessng_time_zone }}"
|
||||||
no_log: true
|
no_log: yes
|
||||||
|
|
||||||
- name: configure paperless-ng database [sqlite]
|
- name: configure paperless-ng database [sqlite]
|
||||||
lineinfile:
|
lineinfile:
|
||||||
path: "{{ paperlessng_directory }}/paperless.conf"
|
path: "{{ paperlessng_directory }}/paperless.conf.template"
|
||||||
regexp: "^#?PAPERLESS_DBHOST="
|
regexp: "^#?PAPERLESS_DBHOST="
|
||||||
state: absent
|
state: absent
|
||||||
when: paperlessng_db_type == 'sqlite'
|
when: paperlessng_db_type == 'sqlite'
|
||||||
|
|
||||||
- name: configure paperless-ng database [postgresql]
|
- name: configure paperless-ng database [postgresql]
|
||||||
lineinfile:
|
lineinfile:
|
||||||
path: "{{ paperlessng_directory }}/paperless.conf"
|
path: "{{ paperlessng_directory }}/paperless.conf.template"
|
||||||
regexp: "{{ item.regexp }}"
|
regexp: "{{ item.regexp }}"
|
||||||
line: "{{ item.line }}"
|
line: "{{ item.line }}"
|
||||||
with_items:
|
with_items:
|
||||||
@ -210,7 +215,17 @@
|
|||||||
- regexp: "^#?PAPERLESS_DBPASS="
|
- regexp: "^#?PAPERLESS_DBPASS="
|
||||||
line: "PAPERLESS_DBPASS={{ paperlessng_db_pass }}"
|
line: "PAPERLESS_DBPASS={{ paperlessng_db_pass }}"
|
||||||
when: paperlessng_db_type == 'postgresql'
|
when: paperlessng_db_type == 'postgresql'
|
||||||
no_log: true
|
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
|
- name: create paperlessng venv
|
||||||
become: yes
|
become: yes
|
||||||
@ -232,9 +247,7 @@
|
|||||||
- name: collect static files
|
- name: collect static files
|
||||||
become: yes
|
become: yes
|
||||||
become_user: "{{ paperlessng_system_user }}"
|
become_user: "{{ paperlessng_system_user }}"
|
||||||
command: "{{ paperlessng_virtualenv }}/bin/python3 manage.py collectstatic --no-input"
|
command: "{{ paperlessng_virtualenv }}/bin/python3 {{ paperlessng_directory }}/src/manage.py collectstatic --no-input"
|
||||||
args:
|
|
||||||
chdir: "{{ paperlessng_directory }}/src"
|
|
||||||
when: paperlessng_current_version.stdout != paperlessng_version | string
|
when: paperlessng_current_version.stdout != paperlessng_version | string
|
||||||
register: static_files
|
register: static_files
|
||||||
changed_when: "'188 unmodified' not in static_files.stdout"
|
changed_when: "'188 unmodified' not in static_files.stdout"
|
||||||
@ -242,9 +255,7 @@
|
|||||||
- name: create database schema
|
- name: create database schema
|
||||||
become: yes
|
become: yes
|
||||||
become_user: "{{ paperlessng_system_user }}"
|
become_user: "{{ paperlessng_system_user }}"
|
||||||
command: "{{ paperlessng_virtualenv }}/bin/python3 manage.py migrate"
|
command: "{{ paperlessng_virtualenv }}/bin/python3 {{ paperlessng_directory }}/src/manage.py migrate"
|
||||||
args:
|
|
||||||
chdir: "{{ paperlessng_directory }}/src"
|
|
||||||
when: paperlessng_current_version.stdout != paperlessng_version | string
|
when: paperlessng_current_version.stdout != paperlessng_version | string
|
||||||
register: database_schema
|
register: database_schema
|
||||||
changed_when: '"No migrations to apply." not in database_schema.stdout'
|
changed_when: '"No migrations to apply." not in database_schema.stdout'
|
||||||
@ -276,13 +287,10 @@
|
|||||||
else:
|
else:
|
||||||
User.objects.create_superuser('{{ paperlessng_superuser_name }}', '{{ paperlessng_superuser_email }}', '{{ paperlessng_superuser_password }}')
|
User.objects.create_superuser('{{ paperlessng_superuser_name }}', '{{ paperlessng_superuser_email }}', '{{ paperlessng_superuser_password }}')
|
||||||
print('changed')
|
print('changed')
|
||||||
command: |
|
command: "{{ paperlessng_virtualenv }}/bin/python3 {{ paperlessng_directory }}/src/manage.py shell -c \"{{ creation_script }}\""
|
||||||
{{ paperlessng_virtualenv }}/bin/python3 manage.py shell -c "{{ creation_script }}"
|
|
||||||
args:
|
|
||||||
chdir: "{{ paperlessng_directory }}/src"
|
|
||||||
register: superuser
|
register: superuser
|
||||||
changed_when: superuser.stdout == 'changed'
|
changed_when: superuser.stdout == 'changed'
|
||||||
no_log: true
|
no_log: yes
|
||||||
|
|
||||||
- name: set ownership and permissions on paperlessng venv
|
- name: set ownership and permissions on paperlessng venv
|
||||||
file:
|
file:
|
||||||
@ -372,7 +380,7 @@
|
|||||||
- paperless-consumer
|
- paperless-consumer
|
||||||
- paperless-scheduler
|
- paperless-scheduler
|
||||||
- paperless-webserver
|
- paperless-webserver
|
||||||
when: paperless_services.changed
|
when: paperless_services.changed or configuration.changed
|
||||||
|
|
||||||
- name: enable paperlessng services
|
- name: enable paperlessng services
|
||||||
systemd:
|
systemd:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user