From e8e9e32f8232f1b7bc422c97c344cf6adc1fa84b Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Tue, 21 Nov 2023 12:04:25 +0100 Subject: [PATCH] Align the parameters convetions. --- defaults/main.yml | 32 +++++++++++----------- tasks/postgresql-streaming-replication.yml | 2 +- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 4072763..535d286 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -99,17 +99,17 @@ psql_streaming_replication_hosts: psql_streaming_replication_user: psql_replica #psql_streaming_replication_pwd: 'use a vault' psql_streaming_replication_config: - - { name: 'wal_level', value: 'replica' } - - { name: 'max_wal_senders', value: '10' } - - { name: 'wal_keep_size', value: '0' } - - { name: 'max_slot_wal_keep_size', value: '50MB' } - - { name: 'wal_compression', value: 'on' } - - { name: 'wal_log_hints', value: 'on' } - - { name: 'hot_standby', value: 'on' } - - { name: 'archive_mode', value: 'always' } - - { name: 'archive_command', value: "cp %p {{ psql_wal_archiving_log_dir }}/%f" } - - { name: 'restore_command', value: "cp {{ psql_wal_archiving_log_dir }}/%f %p" } - - { name: 'archive_cleanup_command', value: "pg_archivecleanup {{ psql_wal_archiving_log_dir }} %r" } + - { name: 'wal_level', value: 'replica', set: 'True' } + - { name: 'max_wal_senders', value: '10', set: 'True' } + - { name: 'wal_keep_size', value: '0', set: 'True' } + - { name: 'max_slot_wal_keep_size', value: '50MB', set: 'True' } + - { name: 'wal_compression', value: 'on', set: 'True' } + - { name: 'wal_log_hints', value: 'on', set: 'True' } + - { name: 'hot_standby', value: 'on', set: 'True' } + - { name: 'archive_mode', value: 'always', set: 'True' } + - { name: 'archive_command', value: "cp %p {{ psql_wal_archiving_log_dir }}/%f", set: 'True' } + - { name: 'restore_command', value: "cp {{ psql_wal_archiving_log_dir }}/%f %p", set: 'True' } + - { name: 'archive_cleanup_command', value: "pg_archivecleanup {{ psql_wal_archiving_log_dir }} %r", set: 'True' } # SSL as a special case psql_enable_ssl: False @@ -121,13 +121,13 @@ psql_ssl_cert_file: '{% if postgresql_letsencrypt_managed %}/var/lib/acme/live/{ # In CentOS/RHEL is /etc/pki/tls/cert.pem psql_ssl_ca_file: '/etc/ssl/certs/ca-certificates.crt' psql_conf_ssl_parameters: - - { name: 'ssl', value: 'true' } - - { name: 'ssl_cert_file', value: '{{ psql_ssl_cert_file }}' } - - { name: 'ssl_key_file', value: '{{ psql_ssl_privkey_file }}' } - - { name: 'ssl_ca_file', value: '{{ psql_ssl_ca_file }}' } + - { name: 'ssl', value: 'true', set: 'True' } + - { name: 'ssl_cert_file', value: '{{ psql_ssl_cert_file }}', set: 'True' } + - { name: 'ssl_key_file', value: '{{ psql_ssl_privkey_file }}', set: 'True' } + - { name: 'ssl_ca_file', value: '{{ psql_ssl_ca_file }}', set: 'True' } psql_conf_disable_ssl_parameters: - - { name: 'ssl', value: 'false' } + - { name: 'ssl', value: 'false', set: 'True' } psql_set_shared_memory: False psql_sysctl_file: 30-postgresql-shm.conf diff --git a/tasks/postgresql-streaming-replication.yml b/tasks/postgresql-streaming-replication.yml index 89ead4e..0e2a2d2 100644 --- a/tasks/postgresql-streaming-replication.yml +++ b/tasks/postgresql-streaming-replication.yml @@ -15,7 +15,7 @@ - name: postgresql-streaming-replication | Setup the streaming replication on the primary community.postgresql.postgresql_set: name: '{{ item.name }}' - value: "{{ item.value }}" + value: "{% if item.set %}{{ item.value }}{% else %}default{% endif %}" loop: '{{ psql_streaming_replication_config }}' when: postgresql_streaming_replication_primary_node == ansible_fqdn notify: Restart postgresql