# ansible-galaxy collection install ansible.posix
# ansible-galaxy collection install community.general
# ansible-galaxy collection install gluster.gluster
#
---
- name: glusterfs lvm create
hosts: glusterfs
become: true
tasks:
- name: glusterfs primary partition create
community.general.parted:
device: /dev/sdb
number: 1
flags: [ lvm ]
state: present
part_end: 100%
- name: GlusterFS volume group (vg_gfs) create
community.general.lvg:
vg: vg_gfs
pvs: /dev/sdb1
- name: GlusterFS logical volume (lv_gfs) create
community.general.lvol:
lv: lv_gfs
vg: vg_gfs
pvs: /dev/sdb1
size: 100%FREE
- name: XFS filesystem create
community.general.filesystem:
fstype: xfs
dev: "{{ item }}"
state: mounted
with_items:
- /dev/vg_gfs/lv_gfs
- name: glusterfs lvm mount
ansible.posix.mount:
src: /dev/mapper/vg_gfs-lv_gfs
path: /data/gfs/
fstype: xfs
state: mounted
...