Skip to content

Commit 26dcf3e

Browse files
committed
Use new amazon.aws.s3_object module + fix indentation
1 parent 4284ca6 commit 26dcf3e

File tree

2 files changed

+35
-35
lines changed

2 files changed

+35
-35
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: "{{ virtualenv_path }}/kayobe"
9+
tasks:
10+
- name: Ensure AWS S3 module prerequisites 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.s3_object:
25+
endpoint_url: "{{ s3_mariadb_backup_url }}"
26+
access_key: "{{ secrets_s3_mariadb_backup_access_key }}"
27+
secret_key: "{{ secrets_s3_mariadb_backup_secret_key }}"
28+
bucket: "{{ s3_mariadb_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 }}"

etc/kayobe/ansible/upload-database-backup-s3.yml

Lines changed: 0 additions & 35 deletions
This file was deleted.

0 commit comments

Comments
 (0)