- include_vars: nextcloud.yml
- import_tasks: apps/nextcloud/prereq.yml

- name: webserver | nextcloud | get tar ball
  uri:
    url: "https://download.nextcloud.com/server/releases/latest.zip"
    dest: "/tmp/nextcloud_latest.zip"
    follow_redirects: all

- name: webserver | nextcloud | extract archive
  unarchive:
    src: "/tmp/nextcloud_latest.zip"
    dest: "/var/www/"
    owner: "{{ webuser }}"
    group: "{{ webuser }}"

- name: webserver | nextcloud | remove temporary file
  file:
    path: "/tmp/nextcloud_latest.zip"
    state: absent