---
- name: Install packages
  include_tasks: packages.yaml

- name: Create Apache2 config
  include_tasks: apache2_template.yaml
  when: not nextcloud_nginx

- name: Enable Apache2 modules
  include_tasks: apache2_modules.yaml
  when: not nextcloud_nginx

- name: Create nginx config
  include_tasks: nginx_template.yaml
  when: nextcloud_nginx

- name: Change ownership of Nextcloud directories
  ansible.builtin.file:
    path: "{{ nextcloud_www_path }}"
    owner: www-data
    group: www-data
    recurse: true