diff --git a/gluster/check-fuse-mounts/check-fuse-mounts.service b/gluster/check-fuse-mounts/check-fuse-mounts.service new file mode 100644 index 0000000..c841595 --- /dev/null +++ b/gluster/check-fuse-mounts/check-fuse-mounts.service @@ -0,0 +1,10 @@ +[Unit] +Description=Check Fuse Mounts and remount them if needed. +After=remote-fs.target + +[Service] +Type=oneshot +ExecStart=/usr/local/sbin/check-fuse-mounts.sh + +[Install] +WantedBy=multi-user.target diff --git a/gluster/check-fuse-mounts/check-fuse-mounts.sh b/gluster/check-fuse-mounts/check-fuse-mounts.sh new file mode 100644 index 0000000..63aa9bf --- /dev/null +++ b/gluster/check-fuse-mounts/check-fuse-mounts.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +header1 () { +cat << HEADER1 +################################################################################ +# ${FUSE} has an issue, trying to remount it +################################################################################ +HEADER1 +} + +for FUSE in $(grep 'fuse.glusterfs' /proc/mounts | cut -d ' ' -f 2); do + if ! stat "${FUSE}" &> /dev/null; then + header1 "${FUSE}" + umount "${FUSE}" + sleep 1s + ls -alh "${FUSE}" + echo "" + fi +done diff --git a/gluster/check-fuse-mounts/check-fuse-mounts.timer b/gluster/check-fuse-mounts/check-fuse-mounts.timer new file mode 100644 index 0000000..047ca93 --- /dev/null +++ b/gluster/check-fuse-mounts/check-fuse-mounts.timer @@ -0,0 +1,8 @@ +[Unit] +Description=Check Fuse Mounts and remount them if needed. + +[Timer] +OnCalendar=*:0/5 + +[Install] +WantedBy=timers.target diff --git a/gluster/check-fuse-mounts/check-fuse-mounts.yml b/gluster/check-fuse-mounts/check-fuse-mounts.yml new file mode 100644 index 0000000..373977f --- /dev/null +++ b/gluster/check-fuse-mounts/check-fuse-mounts.yml @@ -0,0 +1,38 @@ +--- +- hosts: storage_nodes + any_errors_fatal: true + tasks: + - assert: + that: + - ansible_play_hosts == ansible_play_hosts_all + + - name: Copy check-fuse-mounts script + copy: + owner: root + group: root + mode: 0755 + src: "check-fuse-mounts.sh" + dest: "/usr/local/sbin/check-fuse-mounts.sh" + + - name: Copy check-fuse-mounts systemd service + copy: + owner: root + group: root + mode: 0644 + src: "check-fuse-mounts.service" + dest: "/etc/systemd/system/check-fuse-mounts.service" + + - name: Copy check-fuse-mounts systemd timer + copy: + owner: root + group: root + mode: 0644 + src: "check-fuse-mounts.timer" + dest: "/etc/systemd/system/check-fuse-mounts.timer" + + - name: Enable check-fuse-mounts timer + systemd: + name: check-fuse-mounts.timer + daemon_reload: true + state: started + enabled: true diff --git a/gp-scripts/gluster-shell-functions.sh b/gluster/gluster-shell-functions.sh similarity index 100% rename from gp-scripts/gluster-shell-functions.sh rename to gluster/gluster-shell-functions.sh