From 8583309e0f660f2b23456df1988f8e31fa7350d5 Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Fri, 5 Feb 2021 17:37:30 +0100 Subject: [PATCH] alert to remember that the ssh setup has a manual step --- defaults/main.yml | 3 ++- tasks/postgres_pgpool.yml | 4 ++++ templates/pgpool.conf.j2 | 4 ++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/defaults/main.yml b/defaults/main.yml index 60cc67d..406b915 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -123,7 +123,8 @@ psql_db_pwd: "We cannot save the password into the repository. Use another varia # # Those need to be installed on the postgresql server. # -pgpool_fixed_version: '=4.1.4-2.pgdg18.04+1' +pgpool_version: '4.1.4' +pgpool_fixed_version: '={{ pgpool_version }}-2.pgdg18.04+1' postgresql_pgpool_pkgs: - 'postgresql-{{ psql_version }}-pgpool2{{ pgpool_fixed_version }}' diff --git a/tasks/postgres_pgpool.yml b/tasks/postgres_pgpool.yml index 2ff06c3..64545da 100644 --- a/tasks/postgres_pgpool.yml +++ b/tasks/postgres_pgpool.yml @@ -37,6 +37,10 @@ - name: Create the ssh keys for the recovery user user: user={{ pgpool_recovery_user }} generate_ssh_key=yes ssh_key_bits=2048 ssh_key_file=.ssh/id_rsa ssh_key_type=rsa + - name: Remember to trust the ssh keys between the two nodes + debug: + msg: "Remember to trust the ssh keys between the two nodes. You have to setup the .ssh/authorized_keys manually for the user {{ pgpool_recovery_user }}" + - name: Install the pgpool recovery and remote restart scripts. They assume that the postgresql hosts can talk to each other template: src={{ item.1 }}.j2 dest={{ item.0.backend_data_directory }}/{{ item.1 }} owner=postgres group=postgres mode=0500 with_nested: diff --git a/templates/pgpool.conf.j2 b/templates/pgpool.conf.j2 index 3718912..af8522e 100644 --- a/templates/pgpool.conf.j2 +++ b/templates/pgpool.conf.j2 @@ -393,7 +393,11 @@ failback_command = '' # %R = new master database cluster path # %% = '%' character +{% if pgpool_version is version_compare('4.1.4', '>=') +failover_on_backend_error = {{ pgpool_fail_over_on_backend_error }} +{% else %} fail_over_on_backend_error = {{ pgpool_fail_over_on_backend_error }} +{% endif %} # Initiates failover when reading/writing to the # backend communication socket fails # If set to off, pgpool will report an