1
0
Fork 0
mirror of https://github.com/roles-ansible/role-postgresql-backup.git synced 2024-08-16 10:19:49 +02:00

Optionally add password

This commit is contained in:
L3D 2020-07-08 17:56:15 +02:00 committed by L3D
parent 4ae4cf2708
commit 92295ba7ab
No known key found for this signature in database
GPG key ID: 5215C3441797AB2B
2 changed files with 4 additions and 1 deletions

View file

@ -15,6 +15,9 @@ create_backup_dir() {
backup_databases() {
{% for db in postgresql_backup.databases %}
{% if db.password -%}
export PGPASSWORD="{{ db.password }}"
{% endif %}
if (umask 077 && pg_dump -F c -h "{{ db.host | default( 'localhost' ) }}" -U "{{ db.user | default( 'postgres' ) }}" -p "{{ db.port | default( '5432' ) }}" "{{ db.name }}" -f "{{ db.name }}.in_progress.psql"); then
mv "{{ db.name }}.in_progress.psql" "{{ db.name }}.psql"
else

View file

@ -1,6 +1,6 @@
---
# versionscheck
playbook_version_number: 15 # should be int
playbook_version_number: 16 # should be int
playbook_version_path: 'role-postgresql-backup_roles-ansible_github.com.version' # unique string
_postgresql_backup: