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:
parent
4ae4cf2708
commit
92295ba7ab
2 changed files with 4 additions and 1 deletions
|
@ -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
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue