postgresql_version: "15.6" # Options postgresql_install_official_repo: true postgresql_play_group: "postgresql" postgresql_superuser_db: "postgres" postgresql_superuser_username: "postgres" postgresql_superuser_password: "postgres" postgresql_user: "postgres" postgresql_group: "postgres" # SSL options postgresql_ssl: true postgresql_ssl_keep_nonssl_endpoint: false postgresql_self_signed_cert: true postgresql_self_signed_cert_name: "cert" postgresql_cacert_force_append_ips: [] postgresql_cacert_force_append_names: [] postgresql_cacert_multiple_default_gw_workaround: false postgresql_cacert_ca_host_group: "postgresql_cacert_ca_host" postgresql_cacert_clients_group: "postgresql_cacert_clients" postgresql_cacert_ca_trust_anchors_update: true ## WAL-G backup and restore options postgresql_wal_g_install: false postgresql_wal_g_restore_from_backup: false postgresql_wal_g_force_delete_and_restore: false postgresql_wal_g_config_name: ".walg.json" postgresql_wal_g_restore_config_name: ".walg-restore.json" postgresql_wal_g_pitr: 'latest' postgresql_wal_g_restore_backup_name: 'LATEST' postgresql_wal_g_binary_name: "wal-g-pg" #postgresql_postgresql_archive_command: "wal-g wal-push %p" #postgresql_postgresql_restore_command: "wal-g wal-fetch %f %p" #postgresql_restore_dbs_from_backup_command: "wal-g backup-fetch {{ postgresql_wal_g_restore_backup_name }}" #postgresql_restore_wals_from_backup_command: "wal-g wal-fetch %f %p" postgresql_recovery_target_time: "" postgresql_promote_trigger_file: "{{ postgresql_data_dir }}/promote.trigger" postgresql_password_encryption_algorithm: "scram-sha-256" postgresql_max_connections: '1000' postgresql_storage_type: 'ssd' postgresql_default_parameters: data_directory: '{{ postgresql_data_dir }}' archive_mode: "{{ postgresql_archive_mode | default('on') }}" listen_addresses: '*' max_connections: '{{ postgresql_max_connections }}' superuser_reserved_connections: '5' shared_buffers: '{{ (ansible_memory_mb.real.total * 0.25) | round | int }}MB' huge_pages: 'try' dynamic_shared_memory_type: 'posix' max_worker_processes: '{{ ansible_processor_vcpus }}' max_parallel_workers: '{{ ansible_processor_vcpus }}' max_parallel_workers_per_gather: '{{ ((ansible_processor_vcpus / 2) | round | int) if ansible_processor_vcpus > 1 else ansible_processor_vcpus }}' max_parallel_maintenance_workers: '{{ ((ansible_processor_vcpus / 2) | round | int) if ansible_processor_vcpus > 1 else ansible_processor_vcpus }}' work_mem: '{{ (((ansible_memory_mb.real.total - ((ansible_memory_mb.real.total * 0.25) | round | int)) / (postgresql_max_connections | int * 3) / (((ansible_processor_vcpus / 2) | round | int) if ansible_processor_vcpus > 1 else ansible_processor_vcpus)) + 4) | round | int }}MB' maintenance_work_mem: '{{ (ansible_memory_mb.real.total * 0.0625) | round | int }}MB' effective_cache_size: '{{ (ansible_memory_mb.real.total * 0.8) | round | int }}MB' random_page_cost: "{{ '1.1' if postgresql_storage_type == 'ssd' else '4' }}" effective_io_concurrency: "{{ '200' if postgresql_storage_type == 'ssd' else '2' }}" min_wal_size: '1GB' max_wal_size: '4GB' wal_buffers: '16MB' log_destination: 'stderr' logging_collector: 'on' log_directory: 'log' log_filename: 'postgresql-%a.log' log_rotation_age: '1d' log_rotation_size: '0' log_truncate_on_rotation: 'on' log_line_prefix: '%m [%p] ' datestyle: 'iso, mdy' lc_messages: '{{ postgresql_system_locale | default("en_US.UTF-8") }}' lc_monetary: '{{ postgresql_system_locale | default("en_US.UTF-8") }}' lc_numeric: '{{ postgresql_system_locale | default("en_US.UTF-8") }}' lc_time: '{{ postgresql_system_locale | default("en_US.UTF-8") }}' default_text_search_config: 'pg_catalog.english' password_encryption: '{{ postgresql_password_encryption_algorithm }}' hot_standby: 'off' promote_trigger_file: '{{ postgresql_promote_trigger_file }}' postgresql_backup_parameters: archive_command: "{{ postgresql_archive_command | default('cd .')}}" postgresql_restore_parameters: restore_command: "{{ postgresql_restore_command | default('cd .') }}" postgresql_log_dir: "/var/log/postgresql" postgresql_supported_versions: - 13 - 14 - 15