summaryrefslogtreecommitdiffstats
path: root/roles/ands_backup/templates
diff options
context:
space:
mode:
Diffstat (limited to 'roles/ands_backup/templates')
-rwxr-xr-xroles/ands_backup/templates/backup.sh.j216
1 files changed, 13 insertions, 3 deletions
diff --git a/roles/ands_backup/templates/backup.sh.j2 b/roles/ands_backup/templates/backup.sh.j2
index 74fff85..c362957 100755
--- a/roles/ands_backup/templates/backup.sh.j2
+++ b/roles/ands_backup/templates/backup.sh.j2
@@ -15,9 +15,13 @@ etcdctl3 () {
ETCDCTL_API=3 /usr/bin/etcdctl --cert /etc/etcd/peer.crt --key /etc/etcd/peer.key --cacert /etc/etcd/ca.crt --endpoints "https://${hostname}:2379" ${@}
}
-
check=$(df | awk '{ print $6 }' | grep -P "^${volume_path}$")
-[ $? -ne 0 -o -z "$check" ] && { echo "The volume $volume_path is not mounted. Skipping..." ; exit 1 ; }
+if [ $? -ne 0 -o -z "$check" ]; then
+ echo "Mounting $volume_path"
+ mount "$volume_path"
+ check=$(df | awk '{ print $6 }' | grep -P "^${volume_path}$")
+ [ $? -ne 0 -o -z "$check" ] && { echo "The volume $volume_path is not mounted. Skipping..." ; exit 1 ; }
+fi
[ -d "$backup_path" ] && { echo "Something wrong, path $backup_path already exists..." ; exit 1 ; }
@@ -31,7 +35,13 @@ etcdctl3 --endpoints="192.168.213.1:2379" snapshot save "$backup_path/etcd/snaps
# heketi
mkdir -p "$backup_path/heketi" || { echo "Can't create ${backup_path}/heketi" ; exit 1 ; }
-heketi-cli -s http://heketi-storage.glusterfs.svc.cluster.local:8080 --user admin --secret "$(oc get secret heketi-storage-admin-secret -n glusterfs -o jsonpath='{.data.key}' | base64 -d)" topology info --json > "$backup_path/heketi/topology.json"
+heketi-cli -s http://heketi-storage.glusterfs.svc.cluster.local:8080 --user admin --secret "$(oc get secret heketi-storage-admin-secret -n glusterfs -o jsonpath='{.data.key}' | base64 -d)" topology info > "$backup_path/heketi/heketi_topology.json"
+heketi-cli -s http://heketi-storage.glusterfs.svc.cluster.local:8080 --user admin --secret "$(oc get secret heketi-storage-admin-secret -n glusterfs -o jsonpath='{.data.key}' | base64 -d)" db dump > "$backup_path/heketi/heketi_db.json"
+lvs > "$backup_path/heketi/lvs.txt" 2>/dev/null
+lvm fullreport --reportformat json > "$backup_path/heketi/lvm.json" 2>/dev/null
+gluster --xml volume info > "$backup_path/heketi/gluster-info.xml"
+gluster --xml volume status > "$backup_path/heketi/gluster-status.xml"
+gluster volume status > "$backup_path/heketi/gluster.txt"
{% endif %}