summaryrefslogtreecommitdiffstats
path: root/scripts/sbd-device/main.yml
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 06:48:59 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 06:48:59 +0000
commitd835b2cae8abc71958b69362162e6a70c3d7ef63 (patch)
tree81052e3d2ce3e1bcda085f73d925e9d6257dec15 /scripts/sbd-device/main.yml
parentInitial commit. (diff)
downloadcrmsh-d835b2cae8abc71958b69362162e6a70c3d7ef63.tar.xz
crmsh-d835b2cae8abc71958b69362162e6a70c3d7ef63.zip
Adding upstream version 4.6.0.upstream/4.6.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'scripts/sbd-device/main.yml')
-rw-r--r--scripts/sbd-device/main.yml63
1 files changed, 63 insertions, 0 deletions
diff --git a/scripts/sbd-device/main.yml b/scripts/sbd-device/main.yml
new file mode 100644
index 0000000..27fe8d0
--- /dev/null
+++ b/scripts/sbd-device/main.yml
@@ -0,0 +1,63 @@
+# Copyright (C) 2016 Kristoffer Gronlund
+#
+# License: GNU General Public License (GPL)
+version: 2.2
+category: Script
+shortdesc: "Create SBD Device"
+longdesc: |
+ Optional step to initialize and configure the SBD Device.
+
+ Prerequisites:
+
+ * The environment must have shared storage reachable by all nodes.
+
+parameters:
+ - name: device
+ shortdesc: Shared Storage Device
+ example: /dev/disk/by-id/...
+ required: true
+ type: string
+
+ - name: watchdog
+ shortdesc: Watchdog Device
+ value: /dev/watchdog
+ type: string
+
+actions:
+ - shortdesc: Verify configuration
+ sudo: true
+ call: |
+ #!/bin/sh
+ set -e
+ systemctl is-active --quiet sbd && { echo "ERROR: SBD daemon is already running"; exit 1; } || true
+ test -b "{{device}}" || { echo "ERROR: Not a device: {{device}"; exit 1; }
+ lsmod | egrep "(wd|dog)" || { echo "ERROR: No watchdog kernel module loaded"; exit 1; }
+ test -c "{{watchdog}}" || { echo "ERROR: Not a device: {{watchdog}}"; exit 1; }
+
+ - shortdesc: Initialize the SBD device
+ sudo: true
+ nodes: local
+ call: |
+ #!/bin/sh
+ sbd dump &> /dev/null || sbd -d "{{device}}" create
+ # sbd allocate "$(uname -n)" # FIXME
+
+ - shortdesc: Verify SBD Device
+ call: |
+ #!/bin/sh
+ sbd -d "{{device}}" list
+
+ - shortdesc: Configure SBD Daemon
+ sudo: true
+ call: |
+ #!/bin/sh
+ [ -f "/etc/sysconfig/sbd" ] && rm -f /etc/sysconfig/sbd || true
+ <<EOF
+ SBD_DEVICE="{{device}}"
+ SBD_WATCHDOG="yes"
+ SBD_WATCHDOG_DEV="{{watchdog}}"
+ EOF > /etc/sysconfig/sbd
+
+ - shortdesc: Enable SBD Daemon
+ service:
+ - sbd: start