- name: Storage... mount glusterFS_1
  mount:
    src: "{{ groups['gluster_servers'][0] }}:ncgluster1"
    path: "{{ nc_data_dir }}"
    fstype: glusterfs
    opts: acl
    state: mounted

#- name: Main... Mount shared directories
#  mount:
#    src: "{{ nfs_server }}:{{ item.src }}"
#    path: "{{ item.path }}"
#    state: mounted
#    fstype: nfs 
#    opts: nosharecache,context="system_u:object_r:httpd_sys_rw_content_t:s0"
#  with_items:
#    - { src: "{{ nfs_data_path }}", path: "{{ nc_data_dir }}" }
#    - { src: "{{ nfs_web_path }}",  path: "{{ http_webroot }}/nextcloud" }
#  when: nc_multiple != ""

- name: Storage... acl glusterFS_1
  acl:
    path: "{{ nc_data_dir }}"
    entry: "user:{{ nextcloud_websrv_user }}:rwX"
    state: present

- name: Storage... acl default glusterFS_1
  acl:
    path: "{{ nc_data_dir }}"
    entry: "default:user:{{ nextcloud_websrv_user }}:rwX"
    state: present

- name: Storage... permission glusterFS_1
  file:
    owner: "{{ nextcloud_websrv_user }}"
    group: "{{ nextcloud_websrv_group }}"
    path: "{{ nc_data_dir }}"

- name: Storage... mount glusterFS_2
  mount:
    src: "{{ groups['gluster_servers'][0] }}:ncgluster2"
    path: "{{ http_webroot }}"
    fstype: glusterfs
    opts: acl
    state: mounted

- name: Storage... acl glusterFS_2
  acl:
    path: "{{ http_webroot }}"
    entry: "user:{{ nextcloud_websrv_user }}:rwX"
    state: present

- name: Storage... acl default glusterFS_2
  acl:
    path: "{{ http_webroot }}"
    entry: "default:user:{{ nextcloud_websrv_user }}:rwX"
    state: present

- name: Storage... permission glusterFS_2
  file:
    owner: "{{ nextcloud_websrv_user }}"
    group: "{{ nextcloud_websrv_group }}"
    path: "{{ http_webroot }}"

      #- name: Storage... Ensure Nextcloud directories are 0750
      #  shell: find {{ http_webroot }}/nextcloud -type d -exec chmod -c 0750 {} \;
      #  register: nc_installation_chmod_result
      #  changed_when: "nc_installation_chmod_result.stdout != \"\""
      #
      #- name: Storage... Ensure Nextcloud files are 0640
      #  shell: find {{ http_webroot }}/nextcloud -type f -exec chmod -c 0640 {} \;
      #  register: nc_installation_chmod_result
      #  changed_when: "nc_installation_chmod_result.stdout != \"\""

      #- name: Storage... Setting stronger directories ownership
      #  file:
      #    path: "{{ item }}"
      #    state: directory
      #    owner: "{{ nextcloud_websrv_user }}"
      #    group: "{{ nextcloud_websrv_group }}"
      #    recurse: yes
      #    mode: 0750
      #  with_items:
      #    - "{{ nc_data_dir }}"
      #    - "{{ http_webroot }}"
