checksums: True # Optional
fsync_enabled: False # Optional
archive_enabled: False # Optional
+ wal_level: 'logical' # Optional
+ max_replication_slots: 10 # Optional
+ barman_directory: None # Optional
+ # Define cluster as a standby server
+ primary: # Optional
+ host: '127.0.1.1' # Mandatory
+ port: 5433 # Mandatory
+ replication_user: 'replicator' # Mandatory
+ replication_password: 'SuperSecret' # Mandatory
+ restore_command: None # Optional
+ restore_barman_directory: None # Optional
# List of users to be created (optional)
users:
- username: 'replicator' # Mandatory
# These are only used in recovery mode.
-{% if postgres_primary %}
{# In PG < 12 versions all the recovery settings were in a separate recovery.conf file #}
-restore_command = '/usr/bin/barman-wal-restore --user barman --parallel 8 {{ postgres_barman_server }} {{ postgres_primary.restore_directory }} %f %p' # command to use to restore an archived logfile segment
- # placeholders: %p = path of file to restore
- # %f = file name only
- # e.g. 'cp /mnt/server/archivedir/%f %p'
- # (change requires restart)
+{% if postgres_primary and postgres_primary.restore_command is defined %}
+restore_command = '{{ postgres_primary.restore_command }}' # command to use to restore an archived logfile segment
+{% elif postgres_primary and postgres_primary.restore_barman_directory is defined %}
+restore_command = '/usr/bin/barman-wal-restore --user barman --parallel 8 {{ postgres_barman_server }} {{ postgres_primary.restore_barman_directory }} %f %p' # command to use to restore an archived logfile segment
{% else %}
#restore_command = '' # command to use to restore an archived logfile segment
+{% endif %}
# placeholders: %p = path of file to restore
# %f = file name only
# e.g. 'cp /mnt/server/archivedir/%f %p'
# (change requires restart)
-{% endif %}
#archive_cleanup_command = '' # command to execute at every restartpoint
#recovery_end_command = '' # command to execute at completion of recovery
# {{ ansible_managed }}
standby_mode = 'on'
-restore_command = '/usr/bin/barman-wal-restore --user barman --parallel 8 {{ postgres_barman_server }} {{ postgres_primary.restore_directory }} %f %p'
+{% if postgres_primary.restore_command is defined %}
+restore_command = '{{ postgres_primary.restore_command }}'
+{% elif postgres_primary.restore_barman_directory is defined %}
+restore_command = '/usr/bin/barman-wal-restore --user barman --parallel 8 {{ postgres_barman_server }} {{ postgres_primary.restore_barman_directory }} %f %p'
+{% endif %}
primary_conninfo = 'host={{ postgres_primary.host }} port={{ postgres_primary.port }} user={{ postgres_primary.replication_user }} password={{ postgres_primary.replication_password }} sslmode=require'
trigger_file = '/var/lib/postgresql/{{ postgres_version }}/{{ postgres_cluster_name }}/failover.trigger'
recovery_target_timeline='latest'
primary:
host: postgres_one
port: 5432
- restore_directory: "{{ postgres_barman_directory }}"
+ restore_barman_directory: "{{ postgres_barman_directory }}"
replication_user: "replicator"
replication_password: "secret_repli"