Make role compatible with ansible 2.7

Recursive remote copy is supported starting with 2.8 only
Indentation behaviour in literal yaml strings seems to have changed
Regex logic for ImageMagic was flawed (no idea why this worked before)
This commit is contained in:
Fabian Koller 2020-12-29 20:59:49 +01:00
parent bdf2e29843
commit bf3ffc29a9
No known key found for this signature in database
GPG Key ID: 4EFE4C946404B82A

View File

@ -28,6 +28,7 @@
- pngquant
- zlib1g
# dev
- sudo
- build-essential
- python3-setuptools
- python3-wheel
@ -122,23 +123,19 @@
dest: "{{ tempdir.path }}"
when: '"No such file or directory" in paperlessng_current_version.stderr or paperlessng_current_version.stdout != paperlessng_version | string'
- name: change permissions of paperless-ng
- 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 {} ;"
when: '"No such file or directory" in paperlessng_current_version.stderr or paperlessng_current_version.stdout != paperlessng_version | string'
- name: move paperless-ng
copy:
src: "{{ tempdir.path }}/paperless-ng/"
remote_src: yes
dest: "{{ paperlessng_directory }}"
owner: "{{ paperlessng_system_user }}"
group: "{{ paperlessng_system_group }}"
mode: preserve
directory_mode: preserve
command:
cmd: "cp -a {{ tempdir.path }}/paperless-ng/ {{ paperlessng_directory }}"
when: '"No such file or directory" in paperlessng_current_version.stderr or paperlessng_current_version.stdout != paperlessng_version | string'
- name: remove temporary directory
@ -256,8 +253,8 @@
become: yes
become_user: "{{ paperlessng_system_user }}"
# "manage.py createsuperuser" only works on interactive TTYs
command: |
{{ paperlessng_virtualenv }}/bin/python3 manage.py shell -c "
vars:
creation_script: |
from django.contrib.auth.models import User
from django.contrib.auth.hashers import get_hasher
@ -279,7 +276,8 @@
else:
User.objects.create_superuser('{{ paperlessng_superuser_name }}', '{{ paperlessng_superuser_email }}', '{{ paperlessng_superuser_password }}')
print('changed')
"
command: |
{{ paperlessng_virtualenv }}/bin/python3 manage.py shell -c "{{ creation_script }}"
args:
chdir: "{{ paperlessng_directory }}/src"
register: superuser
@ -298,9 +296,10 @@
- name: configure ghostscript for PDF
lineinfile:
path: "/etc/ImageMagick-6/policy.xml"
regexp: '<policy domain="coder" rights="none" pattern="PDF" />'
line: '<policy domain="coder" rights="read|write" pattern="PDF" />'
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 systemd services
ini_file: