Install glusterfs on centos with ansible
----
playbook:
- hosts: server
tasks:
# 1. prepare
- name: "parted {{ brick }}"
parted:
device: "{{ brick }}"
label: gpt
number: 1
flags: [ lvm ]
state: present
- name: "create volume on pv {{ brick }}1"
lvg:
vg: vg_gluster
pvs: "{{ brick }}1"
- name: "create a logical volume"
lvol:
vg: vg_gluster
lv: brick0
size: +100%FREE
- name: "create a xfs filesystem"
filesystem:
fstype: xfs
dev: /dev/vg_gluster/brick0
- name: "create dir"
file:
path: /export
state: directory
- name: "create dir"
file:
path: /export/brick0
state: directory
- name: "mount brick"
mount:
path: /export/brick0
src: /dev/vg_gluster/brick0
fstype: xfs
dump: "1"
passno: "2"
state: mounted
- name: "pause"
pause:
# 2. install
- name: "install centos-release-gluster8"
package:
name: centos-release-gluster8
state: present
- name: "install glusterfs-server"
package:
name: glusterfs-server
state: present
- name: "open glusterfs port"
firewalld:
service: glusterfs
permanent: true
state: enabled
register: firewall_setting
- name: "restart the firewalld service to load in the firewall changes"
service:
name: firewalld
state: restarted
when: firewall_setting.changed
- name: "enable gluster service"
service:
name: glusterd
enabled: yes
state: started
- name: "pause"
pause:
# 3. gluster tsp
- name: "create a tsp"
gluster_peer:
state: present
nodes:
- glusterfs1.fritz.box
- glusterfs2.fritz.box
- glusterfs3.fritz.box
run_once: true
- name: "pause"
pause:
# 4. gluster volume
- name: "create gluster volume"
gluster_volume:
state: present
name: vol01
brick: /export/brick0/vol01
replicas: 3
cluster:
- glusterfs1.fritz.box
- glusterfs2.fritz.box
- glusterfs3.fritz.box
run_once: true
source
centos 8
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.