Add Ceph monitor backup
This commit is contained in:
parent
6362a3b40f
commit
38a6437bbc
|
@ -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
|
||||
|
|
|
@ -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
|
Loading…
Reference in New Issue