---

- name: Checking role configuration
  assert:
    that:
      - nextcloud_database.pass
      - ( nextcloud_admin_pass )
    msg: "DB user and admin user passwords cannot be empty"

- name: Set missing defaults
  set_fact:
    nextcloud_database:
      "{{ _nextcloud_database | combine(nextcloud_database) }}"

- name: Extract download file type
  set_fact:
    download_file_type: "{{ nextcloud_download_url[-4:] }}"

- name: Remove trailing slash from installation directory
  set_fact:
    nextcloud_installation_dir: >-
      {{ nextcloud_installation_dir | regex_replace('/$', '') }}

- name: Read installation parent dir
  set_fact:
    nextcloud_installation_parent_dir:
      "{{ nextcloud_installation_dir | dirname }}"