initial commit

This commit is contained in:
xpk 2019-04-26 13:43:48 +08:00
commit 2dc9554214
Signed by: xpk
GPG Key ID: CD4FF6793F09AB86
2 changed files with 78 additions and 0 deletions

19
README.md Normal file
View File

@ -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
```

59
tasks/main.yml Normal file
View File

@ -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