Skip to content

Instantly share code, notes, and snippets.

@rnowling
Last active August 29, 2015 14:19
Show Gist options
  • Save rnowling/c3f42e907d0ddefe2b2a to your computer and use it in GitHub Desktop.
Save rnowling/c3f42e907d0ddefe2b2a to your computer and use it in GitHub Desktop.
Ansible Playbooks for Gluster
- hosts: storage_nodes
name: Gluster configuration
sudo: true
vars:
- gluster_brick_dirs:
- /srv/gluster/brick1
- /srv/gluster/brick2
- /srv/gluster/brick3
- /srv/gluster/brick4
- /srv/gluster/brick5
- /srv/gluster/brick6
- gluster_volume: gv0
- gluster_replicas: 2
tasks:
- name: Fetch glusterfs repo file
get_url: dest=/etc/yum.repos.d/glusterfs-epel.repo
url=http://download.gluster.org/pub/gluster/glusterfs/LATEST/CentOS/glusterfs-epel.repo
- name: Set repo file permissions
file: owner=root group=root mode=0644
path=/etc/yum.repos.d/glusterfs-epel.repo
- name: Install glusterfs server packages (CentOS)
yum: name={{item}} state=installed enablerepo="glusterfs-epel"
with_items:
- glusterfs-server
- glusterfs-client
- attr
- name: Ensure the GlusterFS service is running (CentOS)
service: name=glusterd state=started
- name: Create Gluster volume
gluster_volume: bricks={{ gluster_brick_dirs | join(",") }} force=true
cluster={{groups.storage_nodes | join(",")}}
replicas=2 name={{gluster_volume}} state=present
run_once: true
- name: Start Gluster volume
gluster_volume: name={{gluster_volume}} state=started
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment