Add Ceph monitor backup

This commit is contained in:
Joshua Boniface 2022-11-05 01:56:48 -04:00
parent 6362a3b40f
commit 38a6437bbc
2 changed files with 30 additions and 3 deletions

View File

@ -638,11 +638,14 @@
state: directory
tags: base-backups
- name: install daily backup script
- name: install daily backup scripts
template:
src: etc/cron.daily/pvc-backup.j2
dest: /etc/cron.daily/pvc-backup
src: "etc/cron.daily/{{ item }}.j2"
dest: "/etc/cron.daily/{{ item }}"
mode: 0755
with_items:
- pvc-backup
- mon-backup
tags: base-backups
- name: install IPMI network interfaces fragment

View File

@ -0,0 +1,24 @@
#!/bin/bash
# Backup the Ceph monitor data
# {{ ansible_managed }}
set -o errexit
BACKUP_DIR="/srv/backups"
DATE="$( date +%Y%m%d )"
HOSTNAME="$( hostname -s )"
if [[ ! -d ${BACKUP_DIR} ]]; then
mkdir -p ${BACKUP_DIR}
fi
pushd ${BACKUP_DIR} &>/dev/null
MON_BACKUP_FILENAME_BASE="ceph-mon-backup"
MON_BACKUP_FILENAME="${BACKUP_DIR}/${MON_BACKUP_FILENAME_BASE}.${DATE}.tar.xz"
tar -cJf ${MON_BACKUP_FILENAME} /var/lib/ceph/mon
find ${BACKUP_DIR} -type f -name "${MON_BACKUP_FILENAME_BASE}*" -mtime +7 -exec rm {} \;
popd &>/dev/null