From bb03984b3b14cfbf26d4bf1d4776553bfd2fc840 Mon Sep 17 00:00:00 2001 From: Vitaliy Kukharik Date: Tue, 12 Mar 2024 08:23:29 +0000 Subject: [PATCH] Add postgresql_listen_addr variable --- roles/patroni/templates/patroni.yml.j2 | 6 +----- vars/main.yml | 5 +++-- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/roles/patroni/templates/patroni.yml.j2 b/roles/patroni/templates/patroni.yml.j2 index fb43a8a26..4952cd4ff 100644 --- a/roles/patroni/templates/patroni.yml.j2 +++ b/roles/patroni/templates/patroni.yml.j2 @@ -121,11 +121,7 @@ bootstrap: postgresql: -{% if not with_haproxy_load_balancing|bool and not pgbouncer_install|bool and (cluster_vip is defined and cluster_vip | length > 0) %} - listen: {{ inventory_hostname }},{{ cluster_vip }},127.0.0.1:{{ postgresql_port }} -{% else %} - listen: {{ inventory_hostname }},127.0.0.1:{{ postgresql_port }} -{% endif %} + listen: {{ postgresql_listen_addr }}:{{ postgresql_port }} connect_address: {{ inventory_hostname }}:{{ postgresql_port }} {% if patroni_superuser_username == 'postgres' %} use_unix_socket: true diff --git a/vars/main.yml b/vars/main.yml index ad84a693f..844830628 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -146,6 +146,7 @@ consul_services: # PostgreSQL variables postgresql_version: "16" # postgresql_data_dir: see vars/Debian.yml or vars/RedHat.yml +postgresql_listen_addr: "0.0.0.0" # Listen on all interfaces. Or use "{{ inventory_hostname }},127.0.0.1" to listen on a specific IP address. postgresql_port: "5432" postgresql_encoding: "UTF8" # for bootstrap only (initdb) postgresql_locale: "en_US.UTF-8" # for bootstrap only (initdb) @@ -305,7 +306,7 @@ pgbouncer_install: true # or 'false' if you do not want to install and configur pgbouncer_processes: 1 # Number of pgbouncer processes to be used. Multiple processes use the so_reuseport option for better performance. pgbouncer_conf_dir: "/etc/pgbouncer" pgbouncer_log_dir: "/var/log/pgbouncer" -pgbouncer_listen_addr: "0.0.0.0" +pgbouncer_listen_addr: "0.0.0.0" # Listen on all interfaces. Or use "{{ inventory_hostname }}" to listen on a specific IP address. pgbouncer_listen_port: 6432 pgbouncer_max_client_conn: 10000 pgbouncer_max_db_connections: 1000 @@ -333,7 +334,7 @@ pgbouncer_pools: # Extended variables (optional) -patroni_restapi_listen_addr: "0.0.0.0" # Listen on all interfaces. Use "{{ inventory_hostname }}" to listen on a specific IP address. +patroni_restapi_listen_addr: "0.0.0.0" # Listen on all interfaces. Or use "{{ inventory_hostname }}" to listen on a specific IP address. patroni_restapi_port: 8008 patroni_ttl: 30 patroni_loop_wait: 10