---
- name: Ensure Apache is installed on {{ ansible_facts['distribution'] }}
  dnf:
    name: httpd
    state: present
  when: nextcloud_websrv in ["apache", "apache2"]
  notify: start http

- name: Set nextcloud webroot on {{ ansible_facts['distribution'] }}
  set_fact:
    nextcloud_webroot: /var/www/html/nextcloud/

- name: Generate Nextcloud configuration for apache
  template:
    dest: /etc/httpd/conf.d/nextcloud.conf
    src: nextcloud_apache2.j2
    mode: 0640
  when: nextcloud_websrv in ["apache", "apache2"]
  notify: restart http
