Add first gluster volume back

This commit is contained in:
2022-09-07 21:56:09 -04:00
parent ffc56dd893
commit e6b7e104cd
6 changed files with 59 additions and 58 deletions

View File

@@ -0,0 +1,12 @@
---
# tasks/volumes/fstab
# setup storage volumes
- name: Create fstab entries
ansible.posix.mount:
path: "{{ mounts.paths[item.name] }}"
src: "{{ item.src }}"
fstype: "xfs"
opts: "defaults,noatime,nofail,x-systemd.device-timeout=10 0 0"
state: "{{ item.status }}"
with_items: "{{mounts[inventory_hostname]}}"

View File

@@ -0,0 +1,45 @@
---
# glusterfs mounts
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# Mount drives in fstab
- include_tasks: fstab.yaml
# manage volumes
- include_tasks: remove_volume.yml
with_items: "{{volumes.removed}}"
- name: debug
debug:
var: item.name
with_items: "{{volumes.replicated}}"
- name: create gluster volumes
gluster_volume:
state: present
start_on_create: yes
name: "{{item.name}}"
brick: "{{mounts.paths[item.name]}}/{{volumes.brick_folder}}"
rebalance: no
# replicas: 2
force: true
cluster: "{{cluster}}"
with_items: "{{volumes.replicated}}"
run_once: true
#- name: create distributed gluster volumes
# gluster_volume:
# state: present
# name: "{{ item.name }}"
# brick: "{{mounts.paths[item.name]}}/{{volumes.brick_folder}}"
# rebalance: no
# replicas: false
## force: true
# cluster: "{{cluster}}"
# with_items: "{{volumes.distributed}}"
# run_once: true

View File

@@ -0,0 +1,25 @@
---
# remove a volume
- name: "check for existing {{mounts.paths[item.name]}}/{{volumes.brick_folder}}/.glusterfs"
stat:
path: "{{mounts.paths[item.name]}}/{{volumes.brick_folder}}/.glusterfs"
register: gluster_volume_config
- name: "Old gluster volume {{item.name}} needs to be removed"
debug:
var: gluster_volume_config.stat.exists
- name: remove old gluster volumes
block:
- name: remove volume
gluster_volume:
state: absent
name: "{{item.name}}"
# rebalance: no
# replicas: false
force: true
cluster: "{{cluster}}"
run_once: true
- name: remove .glusterfs folder
ansible.builtin.shell: "rm -rf {{mounts.paths[item.name]}}/.glusterfs"
when: gluster_volume_config.stat.exists