From 2dc9554214f58efc79b94796ddb707a72abf20fa Mon Sep 17 00:00:00 2001 From: x p k Date: Fri, 26 Apr 2019 13:43:48 +0800 Subject: [PATCH] initial commit --- README.md | 19 ++++++++++++++++ tasks/main.yml | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 78 insertions(+) create mode 100644 README.md create mode 100644 tasks/main.yml diff --git a/README.md b/README.md new file mode 100644 index 0000000..67a9186 --- /dev/null +++ b/README.md @@ -0,0 +1,19 @@ +# playbook for installing gluster 6.1. + +## Nodes +This role sets up 3 servers. All have a secondary data disk attached. + +## Create gluster: 2 replica and 1 arbiter +Run these on gluster-a1: + +``` +gluster peer probe gluster-s1 +gluster peer probe gluster-s2 +gluster vol create gv0 replica 2 arbiter 1 gluster-s1:/.gluster/brick1 gluster-s2:/.gluster/brick1 gluster-a1:/.gluster/brick1 +gluster vol start gv0 +gluster vol set gv0 performance.cache-size256MB +gluster vol set gv0 performance.cache-size 256MB +gluster vol set gv0 nfs.disable On +gluster vol set gv0 server.event-threads 12 +gluster vol set gv0 client.event-threads 4 +``` diff --git a/tasks/main.yml b/tasks/main.yml new file mode 100644 index 0000000..7859445 --- /dev/null +++ b/tasks/main.yml @@ -0,0 +1,59 @@ + - name: Install EPEL + yum: + name: + - epel-release + state: latest + + - name: Write hosts file + blockinfile: + path: /etc/hosts + block: | + 10.66.2.47 gluster-s1 + 10.66.2.178 gluster-s2 + 10.66.2.107 gluster-a1 + + - name: Check if /.gluster/brick1 is already created + stat: + path: /.gluster/brick1 + register: brickDir + + - name: format and mount data disk + block: + - filesystem: + fstype: ext4 + dev: /dev/nvme1n1 + opts: -O dir_index -Ldata + + - file: + path: /.gluster/brick1 + state: directory + + - mount: + path: /.gluster + src: LABEL=data + fstype: ext4 + opts: noatime,nodiratime + state: mounted + + - file: + path: /.gluster/brick1 + state: directory + when: not brickDir.stat.exists + + - name: Install gluster repo + yum: + name: + - centos-release-gluster6 + state: latest + + - name: Intall glusterfs + yum: + name: + - glusterfs-server + - glusterfs-fuse + + - name: Start up glusterd + service: + name: glusterd + state: started + enabled: yes