Skip to content

Commit

Permalink
initial attempt at postgres backup/restore
Browse files Browse the repository at this point in the history
  • Loading branch information
SK1Y101 committed Aug 18, 2023
1 parent fb82b75 commit cbf2b84
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
14 changes: 14 additions & 0 deletions roles/maas_postgres/tasks/backup.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
- name: "Create a backup directory"

Check failure on line 2 in roles/maas_postgres/tasks/backup.yaml

View workflow job for this annotation

GitHub Actions / build

fqcn[action-core]

Use FQCN for builtin module actions (file).
file:
path: "{{ maas_postgres_backup_dir }}"
mode: 0777
state: directory

- name: Dump database to a file
community.postgresql.postgresql_db:
name: "{{ maas_postgres_database }}"
state: dump
target: "{{ maas_postgres_backup_path }}"
become: true
become_user: postgres

Check failure on line 14 in roles/maas_postgres/tasks/backup.yaml

View workflow job for this annotation

GitHub Actions / build

yaml[new-line-at-end-of-file]

No new line character at the end of file
8 changes: 8 additions & 0 deletions roles/maas_postgres/tasks/restore.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
- name: Restore database using the tar format
community.postgresql.postgresql_db:
name: "{{ maas_postgres_database }}"
state: restore
target: "{{ maas_postgres_backup_path }}"
become: true
become_user: postgres

0 comments on commit cbf2b84

Please sign in to comment.