---
- hosts: gluster_data:gluster_client
  name: Basic setup
  vars_files:
    - vars/os
  tasks:
    - include: common/tasks/ssh_host_based_authentication.yml hosts={{groups.all}}
    - include: common/tasks/iptables.yml trusted_hosts={{groups.all}} default_accept=1

    - name: configure ppa
      action: apt_repository repo=ppa:semiosis/ubuntu-glusterfs-3.4
      when: is_debian_or_ubuntu
      tags:
        - gluster

    - name: configure GlusterFS repository
      action: template src=gluster/templates/etc/yum.repos.d/gluster.repo.j2 dest=/etc/yum.repos.d/gluster.repo
      when: is_centos
      tags:
        - gluster
        
  handlers:
    - include: common/handlers/main.yml

- hosts: gluster_data
  name: Gluster configuration
  vars_files:
    - vars/os
  vars:
    - gluster_brick_dir: /srv/gluster/brick
    - gluster_volume: default
  tasks:
    - include: gluster/tasks/main.yml

- hosts: gluster_client
  name: Mount gluster filesystem
  vars_files:
    - vars/os
  vars:
    - gluster_volume: default
  tasks:
    - include: gluster/tasks/client.yml
