File tree Expand file tree Collapse file tree 3 files changed +37
-4
lines changed Expand file tree Collapse file tree 3 files changed +37
-4
lines changed Original file line number Diff line number Diff line change 4444 path : " {{ paperless_ngx_dependency_install_tmp_dir }}"
4545 register : _python_archive_dir
4646
47+ - name : Pepare permissions of tmp dir for unarchiving python sources
48+ ansible.builtin.file :
49+ state : directory
50+ owner : 1000
51+ group : 1000
52+ path : " {{ _python_archive_dir.path }}"
53+
4754 - name : Download and extract python sources
4855 become : true
56+ become_user : " {{ _paperless_ngx_untar_username }}"
4957 ansible.builtin.unarchive :
5058 src : " {{ paperless_ngx_python_release_url }}"
5159 remote_src : true
Original file line number Diff line number Diff line change 6060 {{ _install_tempdir_state.files[0].path }}
6161 {%- endif -%}
6262
63+ - name : Pepare permissions of tmp dir for untaring paperless-ngx sources
64+ ansible.builtin.file :
65+ state : directory
66+ owner : ubuntu
67+ group : ubuntu
68+ path : " {{ _install_tempdir }}"
69+
6370- name : Download and extract paperless-ngx
6471 become : true
72+ become_user : " {{ _paperless_ngx_untar_username }}"
6573 ansible.builtin.unarchive :
6674 src : " {{ _release__download_url }}"
6775 remote_src : true
6876 dest : " {{ _install_tempdir }}"
69- owner : " {{ paperless_ngx_system_user }}"
70- group : " {{ paperless_ngx_system_group }}"
7177 register : _download_and_unarchive_pngx
7278 until :
7379 - " not 'urlopen error' in _download_and_unarchive_pngx.msg | default('')"
8086 ansible.builtin.command :
8187 cmd : " {{ item }}"
8288 with_items :
83- - find {{ _install_tempdir }} -type d -exec chmod -c 0750 {} ;
84- - find {{ _install_tempdir }} -type f -exec chmod -c 0640 {} ;
89+ - find {{ _install_tempdir }} -type d -exec chmod -c 0750 {} \; -exec chown {{ paperless_ngx_system_user }}:{{ paperless_ngx_system_group }} {} \ ;
90+ - find {{ _install_tempdir }} -type f -exec chmod -c 0640 {} \; -exec chown {{ paperless_ngx_system_user }}:{{ paperless_ngx_system_group }} {} \ ;
8591 register : _set_temp_install_permissions
8692 changed_when :
8793 - ' not _set_temp_install_permissions.stdout == ""'
Original file line number Diff line number Diff line change 1111 fail_msg : " This role only works with systemd"
1212 success_msg : " systemd found"
1313
14+ - name : Determine user name with id 1000 as become-user for unarchive tasks
15+ block :
16+ - name : Query passwd database for user with id 1000
17+ ansible.builtin.getent :
18+ database : passwd
19+ key : 1000
20+ split : ' :'
21+ register : _getent_query_result
22+
23+ - name : Set fact username for user with id 1000
24+ ansible.builtin.set_fact :
25+ _paperless_ngx_untar_username : " {{ ( _getent_query_result['ansible_facts']['getent_passwd'] | dict2items | selectattr('value.2', 'equalto', '1000') )[0].value[3] }}"
26+ when : (paperless_ngx_conf_usermap_uid is undefined) or paperless_ngx_conf_usermap_uid != "1000"
27+
28+ - name : Set fact username for user with id 1000
29+ ansible.builtin.set_fact :
30+ _paperless_ngx_untar_username : " {{ paperless_ngx_system_user }}"
31+ when : (paperless_ngx_conf_usermap_uid is defined) and paperless_ngx_conf_usermap_uid == "1000"
32+
1433- name : Compare versions of installed ansible and required ansible
1534 ansible.builtin.assert :
1635 that : " ansible_version.full is version_compare(ansible_version_minimum, '>=')"
You can’t perform that action at this time.
0 commit comments