---

- name: install needed packages
  yum: pkg={{ item }} state=present
  with_items:
  - glusterfs-server
  tags:
  - packages

- name: make the datadir
  file: dest={{ datadir }} owner={{ owner }} group={{ group }} state=directory
  notify:
  - restart glusterd

- name: make the datapath
  file: dest={{ datadir }}/{{ name }} state=directory
  notify:
  - restart glusterd

- name: copy over the server config
  template: src=server.config dest=/etc/glusterfs/glusterd.vol mode=0640
  notify:
  - restart glusterd
  
- name: glusterd service
  service: name=glusterd state=started enabled=yes
