Saturday 26 November 2022

Postgresql Database Dump and restore Using Ansible

 Postgresql Database Dump and restore Using Ansible




---
- name: Take the backup
hosts: localhost
tasks:
- name: DB backup
postgresql_db:
name: postgres
state: dump
target: /backup/postgresql.sql.gz ================================================================
---
- name: Restore from Dump
hosts: db1
tasks:
- name: Restore DB
postgresl_db:
name: db1
state: restore
target: /tmp/backup.sql.gz
become: true
become_user: postgres

No comments:

Post a Comment