k3s_setup/roles/gluster/tasks/main.yaml

62 lines
1.1 KiB
YAML

---
- name: install rpcbind
apt:
name: rpcbind
- name: disable rpcbind from the internet
iptables:
action: insert
chain: INPUT
comment: drop portmapper
in_interface: "!nodevpn"
jump: DROP
protocol: "{{item}}"
destination_port: "111"
with_items:
- tcp
- udp
- name: install gluster package
apt:
name: glusterfs-server
- name: start and enable gluster
service:
enabled: yes
name: glusterd
state: started
- name: filesystem on gluster disk
filesystem:
dev: /dev/sdb
fstype: ext4
- name: mount gluster disk
mount:
path: /mnt/gluster
src: /dev/sdb
opts: noatime
fstype: ext4
state: mounted
- name: gluster peers
gluster_peer:
nodes:
- node01
- node02
- node03
- name: gluster volume
gluster_volume:
name: data
replicas: 3
state: started
bricks: /mnt/gluster/data
cluster:
- node01
- node02
- node03
- name: gluster client package
apt:
name: glusterfs-client
- name: mount gluster brick
mount:
path: /data
src: "{{ansible_nodename}}:/data"
options: noatime
fstype: glusterfs
state: mounted