From d4c613a07a2b717e516efecaa2147eda6401fd80 Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Thu, 15 Jul 2021 14:58:50 +1000 Subject: [PATCH] Add paste01.opendev.org to backup Change-Id: Iec6b916bd27a5333d28d1fdc931d4f41165bf50c --- inventory/service/groups.yaml | 1 + .../service/host_vars/paste01.opendev.org.yaml | 3 +++ playbooks/roles/lodgeit/tasks/main.yaml | 14 +++++++++++++- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/inventory/service/groups.yaml b/inventory/service/groups.yaml index a3146c6a62..42516c189f 100644 --- a/inventory/service/groups.yaml +++ b/inventory/service/groups.yaml @@ -23,6 +23,7 @@ groups: - refstack01.openstack.org - kdc03.openstack.org - eavesdrop01.opendev.org + - paste01.opendev.org # All these servers are "special-cased" in specifically # as they are puppet and should be replaced "soon" - ethercalc02.openstack.org diff --git a/inventory/service/host_vars/paste01.opendev.org.yaml b/inventory/service/host_vars/paste01.opendev.org.yaml index b2ef6cff36..4f25e8809b 100644 --- a/inventory/service/host_vars/paste01.opendev.org.yaml +++ b/inventory/service/host_vars/paste01.opendev.org.yaml @@ -3,3 +3,6 @@ letsencrypt_certs: - paste01.opendev.org - paste.opendev.org - paste.openstack.org +borg_backup_excludes_extra: + # live db; dumped with mysqldump + - /var/lib/lodgeit diff --git a/playbooks/roles/lodgeit/tasks/main.yaml b/playbooks/roles/lodgeit/tasks/main.yaml index a9a17b4e51..09339b84f3 100644 --- a/playbooks/roles/lodgeit/tasks/main.yaml +++ b/playbooks/roles/lodgeit/tasks/main.yaml @@ -83,4 +83,16 @@ shell: cmd: docker image prune -f -# TODO : db backups +- name: Create backup streaming config dir + file: + path: /etc/borg-streams + state: directory + +- name: Setup container mariadb backup jobs + block: + - name: Create mariadb streaming file + copy: + content: >- + /usr/local/bin/docker-compose -f /etc/lodgeit-compose/docker-compose.yaml exec -T mariadb + bash -c '/usr/bin/mysqldump --all-databases --skip-extended-insert --single-transaction -uroot -p"$MYSQL_ROOT_PASSWORD"' + dest: /etc/borg-streams/mariadb