summaryrefslogtreecommitdiff
path: root/roles/nextcloud/tasks/download.yml
blob: 0aaf8584c66bd77cb907a5fef2be1f3253d63d0f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
- name: install php packages
  apt:
    name: '{{ nextcloud_php_present }}'
    install_recommends: 'no'

- name: nc_download | Create and set directory ownership & permissions for the webroot folder
  ansible.builtin.file:
    path: "{{ nextcloud_webroot }}" 
    mode: "u=rwX,g=rX,o-rwx"
    recurse: true
    state: directory
    owner: "{{ nextcloud_websrv_user }}"
    group: "{{ nextcloud_websrv_group }}"

- name: nc_download | Download and extract Nextcloud
  block:
    - name: nc_download | Download & extract Nextcloud to /tmp."
      ansible.builtin.unarchive:      
        remote_src: true
        src: "{{ nextcloud_full_src | default(nextcloud_calculated_url) }}"
        dest: "/tmp/"
      vars:
        nextcloud_calculated_url: "{{ nextcloud_repository }}/{{ nextcloud_version_channel }}/{{ nextcloud_calculated_file }}"
        nextcloud_calculated_file: "{{ nextcloud_dl_file_name + '.' + nextcloud_archive_format }}"

    - name: "nc_download | Move extracted files to {{ nextcloud_webroot }}"
      ansible.builtin.command: "cp -r /tmp/nextcloud/. {{ nextcloud_webroot }}/"
      when: nextcloud_webroot is not none
      register: output
      changed_when: "output.rc == 0"  

    - name: nc_download | Remove nextcloud archive files
      ansible.builtin.file:
        path: /tmp/nextcloud
        state: absent