Finish db restore logic

- rename _backup_dir to backup_dir
  - add towerBackupClaim status to make the pvc name easier to find for users
This commit is contained in:
Christian M. Adams
2021-04-01 22:57:37 -04:00
parent 8422f6fbd9
commit 0580398c90
12 changed files with 82 additions and 70 deletions

View File

@@ -48,28 +48,28 @@
- name: Set backup directory name
set_fact:
_backup_dir: "/backups/tower-openshift-backup-{{ now }}"
backup_dir: "/backups/tower-openshift-backup-{{ now }}"
- name: Create directory for backup
community.kubernetes.k8s_exec:
namespace: "{{ meta.namespace }}"
pod: "{{ meta.name }}-db-management"
command: >-
mkdir -p {{ _backup_dir }}
mkdir -p {{ backup_dir }}
- name: Precreate file for database dump
community.kubernetes.k8s_exec:
namespace: "{{ meta.namespace }}"
pod: "{{ meta.name }}-db-management"
command: >-
touch {{ _backup_dir }}/tower.db
touch {{ backup_dir }}/tower.db
- name: Set permissions on file for database dump
community.kubernetes.k8s_exec:
namespace: "{{ meta.namespace }}"
pod: "{{ meta.name }}-db-management"
command: >-
chmod 0600 {{ _backup_dir }}/tower.db
chmod 0600 {{ backup_dir }}/tower.db
- name: Set pg_dump command
set_fact:
@@ -85,5 +85,5 @@
namespace: "{{ meta.namespace }}"
pod: "{{ meta.name }}-db-management"
command: >-
bash -c "PGPASSWORD={{ awx_postgres_pass }} {{ pgdump }} > {{ _backup_dir }}/tower.db"
bash -c "PGPASSWORD={{ awx_postgres_pass }} {{ pgdump }} > {{ backup_dir }}/tower.db"
register: data_migration