nc_download.yml 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. ---
  2. - name: Download... Download Nextcloud archive
  3. get_url:
  4. url: "{{ NEXTCLOUD_URL }}"
  5. dest: /tmp/{{ NEXTCLOUD_TARBALL }}
  6. checksum: "sha256:{{ NEXTCLOUD_URL }}.sha256"
  7. - name: Download... Download generic GPG key
  8. get_url:
  9. url: "{{ NEXTCLOUD_GPG }}"
  10. dest: /tmp/nextcloud.asc
  11. - name: Download... Download Nextcloud release GPG key
  12. get_url:
  13. url: "{{ NEXTCLOUD_URL }}.asc"
  14. dest: /tmp/{{ NEXTCLOUD_TARBALL }}.asc
  15. - name: Download... Import Nextcloud GPG key
  16. shell: gpg --import /tmp/nextcloud.asc
  17. - name: Download... See Nextcloud GPG stored
  18. set_fact:
  19. correct_gpg: "{{ GPG_FINGERPRINT }}"
  20. - name: Download... Verify Nextcloud GPG
  21. shell: gpg --verify /tmp/{{ NEXTCLOUD_TARBALL }}.asc /tmp/{{ NEXTCLOUD_TARBALL }} 2>&1 | tail -n 1 | cut -d ':' -f2 | tr -d ' '
  22. register: nc_fingerprint
  23. failed_when: (nc_fingerprint.stdout|string not in correct_gpg)
  24. - name: Download... Extract Nextcloud
  25. unarchive:
  26. src: /tmp/{{ NEXTCLOUD_TARBALL }}
  27. dest: "{{ http_webroot }}"
  28. remote_src: true
  29. creates: "{{ http_webroot }}/nextcloud/occ"
  30. - name: Download... Ensure Nextcloud files are 0640
  31. shell: find {{ http_webroot }}/nextcloud -type f -exec chmod -c 0640 {} \;
  32. register: nc_installation_chmod_result
  33. changed_when: "nc_installation_chmod_result.stdout != \"\""
  34. - name: Download... Setting stronger directory ownership
  35. file:
  36. path: "{{ http_webroot }}/nextcloud/"
  37. recurse: true
  38. owner: "{{ nextcloud_websrv_user }}"
  39. group: "{{ nextcloud_websrv_group }}"
  40. state: directory
  41. - name: Download... Ensure Nextcloud .htaccess and .user.ini are 0644
  42. file:
  43. path: "{{ item }}"
  44. mode: u=rw,g=r,o=r
  45. with_items:
  46. - "{{ http_webroot }}/nextcloud/.htaccess"
  47. - "{{ http_webroot }}/nextcloud/.user.ini"
  48. - name: Download... Remove Nextcloud tmp files
  49. ansible.builtin.file:
  50. path: "{{ item }}"
  51. state: absent
  52. with_items:
  53. - "/tmp/{{ NEXTCLOUD_TARBALL }}.asc"
  54. - "/tmp/{{ NEXTCLOUD_TARBALL }}"
  55. - "/tmp/nextcloud.asc"