1
0
Fork 0
mirror of https://github.com/roles-ansible/role-postgresql-backup.git synced 2024-07-04 07:58:53 +02:00
Ansible role to automaticcally backup your postgresql database you created with ansible
Go to file
2023-03-02 16:29:14 +01:00
.github Yaml fixed 2023-03-02 16:29:14 +01:00
defaults install tar and gzip if needed 2020-07-21 18:46:54 +02:00
tasks update linting and adding hostname to backup file 2023-03-02 16:21:16 +01:00
templates update linting and adding hostname to backup file 2023-03-02 16:21:16 +01:00
vars update linting and adding hostname to backup file 2023-03-02 16:21:16 +01:00
.yamllint Yaml fixed 2023-03-02 16:29:14 +01:00
LICENSE initialize ansible role 2020-07-08 14:01:03 +02:00
README.md Add testing info 2020-07-21 18:52:06 +02:00

role-postgresql-backup

Ansible role to automaticcally backup your postgresql database you created with ansible

Configuration

  • required packages to create postgres dump and add a cronjob
postgresql_backup:
  required_packages:
    - postgresql-client
    - cron
  • Where do we store our database backups:
postgresql_backup:
  backup_dir: /var/backup/postgresql
  • Dateformat we use to create daily backup folder
postgresql_backup:
  date_format: '%Y-%m-%d_%H-%M'
  • Create cronjob to run backup script?
postgresql_backup:
  cron: true
  • User that should run the backup script as cronjob
postgresql_backup:
  user: root
  • Minute and hour to run the cronjob
postgresql_backup:
  cron_minute: '*'
  cron_hour: '0'
  • Which database*(s)* do we want to backup` (example) The values for host and port are optional!
postgresql_backup:
  databases:
   - name: psql_database_name
     user: psql_database_user
     password: Topf_Secret1
     host: localhost
     port: 5432
  • Export Option for pg_dump.
  • p plain-text SQL script
  • c custom-format archive
  • d directory-format archive
  • t tar-format archive
postgresql_backup:
  export_option: "p"
  • save backup as tar.gz
postgresql_backup:
  create_tar_gz: true
  • Perform basic versionscheck (true is recomended)
submodules_versioncheck: false

Testing

This role is tested with different github actions. -> Link

Feel free to add some molecule if you like!