Added create-cluster.sh script and renamed crt.sh to create-container.sh.
authorZoltán Felleg <zoltan.felleg@userrendszerhaz.hu>
Wed, 8 Dec 2021 21:09:25 +0000 (22:09 +0100)
committerZoltán Felleg <zoltan.felleg@userrendszerhaz.hu>
Wed, 8 Dec 2021 21:09:25 +0000 (22:09 +0100)
scripts/create-cluster.sh [new file with mode: 0755]
scripts/create-container.sh [moved from scripts/crt.sh with 100% similarity]

diff --git a/scripts/create-cluster.sh b/scripts/create-cluster.sh
new file mode 100755 (executable)
index 0000000..ec4b54b
--- /dev/null
@@ -0,0 +1,42 @@
+#!/bin/sh
+set -x
+
+
+pcs cluster status
+
+read -p "Press enter to stop and destroy the existing cluster"
+
+pcs cluster stop --all
+pcs cluster destroy --all
+
+sleep 5
+
+systemctl enable pcsd
+systemctl start pcsd
+
+#passwd hacluster
+
+pcs host auth vhost1 addr=10.228.93.1 -u hacluster -p Passw@rd01
+pcs host auth vhost2 addr=10.228.93.2 -u hacluster -p Passw@rd01
+
+pcs cluster setup lxc-cluster --start --enable \
+    vhost1 addr=10.228.93.1 addr=vhost1.mlx1.useribm.hu addr=vhost1.mlx2.useribm.hu \
+    vhost2 addr=10.228.93.2 addr=vhost2.mlx1.useribm.hu addr=vhost2.mlx2.useribm.hu
+
+CLUSTER_NODES_STARTED=0
+while [ $CLUSTER_NODES_STARTED -lt 2 ]
+do
+    sleep 5
+    pcs cluster status
+    CLUSTER_NODES_STARTED=$(pcs cluster status | grep ': Online' | grep -w -e vhost1 -e vhost2 | wc -l)
+done
+
+pcs property set maintenance-mode=true
+
+pcs resource create lxc-fs ocf:heartbeat:Filesystem \
+    device=/dev/mapper/lxc directory=/lxc fstype=ext4
+pcs resource create lxc-service systemd:lxc
+
+pcs resource group add lxc-group \
+    lxc-fs \
+    lxc-service
similarity index 100%
rename from scripts/crt.sh
rename to scripts/create-container.sh