File tree Expand file tree Collapse file tree 3 files changed +77
-0
lines changed
Expand file tree Collapse file tree 3 files changed +77
-0
lines changed Original file line number Diff line number Diff line change 1+ ================
2+ Database Backups
3+ ================
4+
5+ An OpenStack deployment includes MariaDB to be used as a database by the
6+ OpenStack services. Kayobe has `built-in support
7+ <https://docs.openstack.org/kayobe/latest/administration/overcloud.html#performing-database-backups> `__
8+ for backing up this database, but these backups are just stored on one of the
9+ OpenStack controller hosts.
10+
11+ We have a playbook ``tools/upload-database-backup-s3.yml `` which can be used to
12+ upload these backups to an S3 object store. To use this, you will need:
13+
14+ * The endpoint of the S3 object store.
15+
16+ * EC2 access and secret keys to authenticate to the S3 object store.
17+
18+ * The name of a pre-existing bucket in the S3 object store.
19+
20+ These should be set as follows:
21+
22+ .. code-block :: yaml
23+ :caption : ` ` $KAYOBE_CONFIG_PATH/inventory/group_vars/all/mariadb-backup``
24+
25+ s3_mariadb_backup_url : " <s3-endpoint>"
26+ s3_mariadb_backup_bucket : " <s3-bucket-name>"
27+
28+ .. code-block :: yaml
29+ :caption : ` ` $KAYOBE_CONFIG_PATH/environments/$KAYOBE_ENVIRONMENT/secrets.yml``
30+
31+ secrets_s3_mariadb_backup_access_key : " <s3-access-key>"
32+ secrets_s3_mariadb_backup_secret_key : " <s3-secret-access-key"
33+
34+ You may also want to hook this to run after ``kayobe overcloud database
35+ backup ``:
36+
37+ .. code-block :: bash
38+
39+ mkdir -p $KAYOBE_CONFIG_PATH /hooks/overcloud-database-backup/post.d/
40+ ln -s ../../../ansible/tools/upload-database-backup-s3.yml $KAYOBE_CONFIG_PATH /hooks/overcloud-database-backup/post.d/10-upload-database-backup-s3.yml
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ This guide is for operators of the StackHPC Kayobe configuration project.
1010 ceph-management
1111 control-plane-operation
1212 customising-horizon
13+ database-backups
1314 gpu-in-openstack
1415 bifrost-hardware-inventory-management
1516 hotfix-playbook
Original file line number Diff line number Diff line change 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+ - name : Upload MariaDB backups to S3
6+ hosts : controllers[0]
7+ vars :
8+ backup_directory : " /var/lib/docker/volumes/mariadb_backup/_data"
9+ kayobe_venv : " {{ virtualenv_path }}/kayobe"
10+ tasks :
11+ - name : Ensure AWS S3 module prerequisites are available
12+ ansible.builtin.pip :
13+ name :
14+ - boto3
15+ - botocore
16+ virtualenv : " {{ kayobe_venv }}"
17+
18+ - name : Build backup file list
19+ ansible.builtin.find :
20+ paths : " {{ backup_directory }}"
21+ become : True
22+ register : backups
23+
24+ - name : Upload backup files to S3
25+ amazon.aws.s3_object :
26+ endpoint_url : " {{ s3_mariadb_backup_url }}"
27+ access_key : " {{ secrets_s3_mariadb_backup_access_key }}"
28+ secret_key : " {{ secrets_s3_mariadb_backup_secret_key }}"
29+ bucket : " {{ s3_mariadb_backup_bucket }}"
30+ object : " {{ item.path | basename }}"
31+ src : " {{ item.path }}"
32+ mode : put
33+ overwrite : different
34+ validate_certs : False
35+ become : True
36+ with_items : " {{ backups.files }}"
You can’t perform that action at this time.
0 commit comments