Add Ceph monitor backup

This commit is contained in:
Joshua Boniface 2023-09-01 15:42:29 -04:00
parent c3ce11dacf
commit 8f685116b7
2 changed files with 30 additions and 3 deletions

View File

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