Skip to content

Commit 4284ca6

Browse files
darmachMoteHue
authored andcommitted
Overcloud database backup S3 upload
Added playbook uploading overcloud MariaDB backups to S3 compatible storage. Can be linked as overcloud database backup post hook.
1 parent 34f1bb2 commit 4284ca6

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
# This playbook uploads MariaDB backups to an AWS S3 object store.
3+
# Can be linked as a post hook for overcloud-database-backup.
4+
5+
- hosts: controllers[0]
6+
vars:
7+
backup_directory: "/var/lib/docker/volumes/mariadb_backup/_data"
8+
kayobe_venv: "/opt/kayobe/venvs/kayobe"
9+
tasks:
10+
- name: Ensure AWS S3 module prerequisities are available
11+
pip:
12+
name:
13+
- boto3
14+
- botocore
15+
virtualenv: "{{ kayobe_venv }}"
16+
17+
- name: Build backup file list
18+
find:
19+
paths: "{{ backup_directory }}"
20+
become: True
21+
register: backups
22+
23+
- name: Upload backup files to S3
24+
amazon.aws.aws_s3:
25+
s3_url: "{{ s3_url }}"
26+
access_key: "{{ secrets_s3_access_key }}"
27+
secret_key: "{{ secrets_s3_secret_key }}"
28+
bucket: "{{ s3_mariadb_mysql_backup_bucket }}"
29+
object: "{{ item.path | basename }}"
30+
src: "{{ item.path }}"
31+
mode: put
32+
overwrite: different
33+
validate_certs: False
34+
become: True
35+
with_items: "{{ backups.files }}"

0 commit comments

Comments
 (0)