diff --git a/roles/execute_binary_upgrade/tasks/validate_execute_binary_upgrade.yml b/roles/execute_binary_upgrade/tasks/validate_execute_binary_upgrade.yml index a229a27ce..ef4e2e15f 100644 --- a/roles/execute_binary_upgrade/tasks/validate_execute_binary_upgrade.yml +++ b/roles/execute_binary_upgrade/tasks/validate_execute_binary_upgrade.yml @@ -204,7 +204,7 @@ - name: Check that all required packages have been installed ansible.builtin.assert: that: - - "{{ ansible_facts.packages[package] }} is defined" + - ansible_facts.packages[package] is defined fail_msg: "Package {{ package }} has not been installed." success_msg: "Package {{ package }} has been installed." loop: "{{ package_list }}" diff --git a/roles/install_dbserver/tasks/validate_install_dbserver.yml b/roles/install_dbserver/tasks/validate_install_dbserver.yml index e1b056b46..19808d4c0 100644 --- a/roles/install_dbserver/tasks/validate_install_dbserver.yml +++ b/roles/install_dbserver/tasks/validate_install_dbserver.yml @@ -97,12 +97,21 @@ - ansible_os_family == 'RedHat' - pg_version|int > 10 -- name: Install python-apt package +- name: Install python-apt package for Debian 9/10 ansible.builtin.package: name: python-apt state: present when: - ansible_os_family == 'Debian' + - ansible_distribution_major_version in ['9', '10'] + +- name: Install python3-apt package for Debian 11/12 + ansible.builtin.package: + name: python3-apt + state: present + when: + - ansible_os_family == 'Debian' + - ansible_distribution_major_version in ['11', '12'] - name: Set package list for PG Debian ansible.builtin.set_fact: @@ -187,7 +196,7 @@ - name: Check that all required packages have been installed ansible.builtin.assert: that: - - "{{ ansible_facts.packages[package] }} is defined" + - ansible_facts.packages[package] is defined fail_msg: "Package {{ package }} has not been installed." success_msg: "Package {{ package }} has been installed." loop: "{{ package_list }}" diff --git a/roles/setup_barman/tasks/validate_setup_barman.yml b/roles/setup_barman/tasks/validate_setup_barman.yml index 452af7f6e..a96c9954c 100644 --- a/roles/setup_barman/tasks/validate_setup_barman.yml +++ b/roles/setup_barman/tasks/validate_setup_barman.yml @@ -42,7 +42,7 @@ - name: Check if backup server has been configured correctly. ansible.builtin.assert: that: - - barman_list_server_res.stdout_lines is search('{{ primary_inventory_hostname }}') + - barman_list_server_res.stdout_lines is search(primary_inventory_hostname) fail_msg: "{{ primary_inventory_hostname }} backup server was not configured correctly." success_msg: "{{ primary_inventory_hostname }} backup server was configured correctly." run_once: true @@ -64,7 +64,7 @@ - name: Check if barman home directory has been configured correctly ansible.builtin.assert: that: - - barman_show_server_res.stdout_lines is search('{{ barman_home }}') + - barman_show_server_res.stdout_lines is search(barman_home) fail_msg: "{{ barman_home }} directory was not configured correctly" success_msg: "{{ barman_home }} directory was configured correctly" run_once: true diff --git a/roles/setup_barmanserver/tasks/validate_setup_barmanserver.yml b/roles/setup_barmanserver/tasks/validate_setup_barmanserver.yml index 7c5ad8eeb..f153defe3 100644 --- a/roles/setup_barmanserver/tasks/validate_setup_barmanserver.yml +++ b/roles/setup_barmanserver/tasks/validate_setup_barmanserver.yml @@ -8,7 +8,7 @@ - name: Check that all required barman packages have been installed ansible.builtin.assert: that: - - "{{ ansible_facts.packages[item] }} is defined" + - ansible_facts.packages[item] is defined fail_msg: "Package {{ item }} has not been installed." success_msg: "Package {{ item }} has been installed." loop: diff --git a/roles/setup_dbt2/tasks/validate_setup_dbt2.yml b/roles/setup_dbt2/tasks/validate_setup_dbt2.yml index 37681f76c..f1f71b784 100644 --- a/roles/setup_dbt2/tasks/validate_setup_dbt2.yml +++ b/roles/setup_dbt2/tasks/validate_setup_dbt2.yml @@ -18,7 +18,7 @@ - name: Check that all packages in dbt2_db_pkg_list has been installed ansible.builtin.assert: that: - - "{{ ansible_facts.packages[package] }} is defined" + - ansible_facts.packages[package] is defined fail_msg: "Package {{ package }} has not been installed." success_msg: "Package {{ package }} has been installed." loop: "{{ dbt2_db_pkg_list }}" diff --git a/roles/setup_dbt2_client/tasks/validate_setup_dbt2_client.yml b/roles/setup_dbt2_client/tasks/validate_setup_dbt2_client.yml index 85dca83df..5c6355a90 100644 --- a/roles/setup_dbt2_client/tasks/validate_setup_dbt2_client.yml +++ b/roles/setup_dbt2_client/tasks/validate_setup_dbt2_client.yml @@ -11,7 +11,7 @@ - name: Check that all packages in dbt2_client_pkg_list has been installed ansible.builtin.assert: that: - - "{{ ansible_facts.packages[package] }} is defined" + - ansible_facts.packages[package] is defined fail_msg: "Package {{ package }} has not been installed." success_msg: "Package {{ package }} has been installed." loop: "{{ dbt2_client_pkg_list }}" diff --git a/roles/setup_dbt2_driver/tasks/validate_setup_dbt2_driver.yml b/roles/setup_dbt2_driver/tasks/validate_setup_dbt2_driver.yml index 7f6afa3f4..d971929d8 100644 --- a/roles/setup_dbt2_driver/tasks/validate_setup_dbt2_driver.yml +++ b/roles/setup_dbt2_driver/tasks/validate_setup_dbt2_driver.yml @@ -11,7 +11,7 @@ - name: Check that all packages in dbt2_driver_pkg_list has been installed ansible.builtin.assert: that: - - "{{ ansible_facts.packages[package] }} is defined" + - ansible_facts.packages[package] is defined fail_msg: "Package {{ package }} has not been installed." success_msg: "Package {{ package }} has been installed." loop: "{{ dbt2_driver_pkg_list }}" diff --git a/roles/setup_dbt3/tasks/validate_setup_dbt3.yml b/roles/setup_dbt3/tasks/validate_setup_dbt3.yml index a4bd18f17..7d35b5f25 100644 --- a/roles/setup_dbt3/tasks/validate_setup_dbt3.yml +++ b/roles/setup_dbt3/tasks/validate_setup_dbt3.yml @@ -11,7 +11,7 @@ - name: Check that all packages in dbt3_db_pkg_list has been installed ansible.builtin.assert: that: - - "{{ ansible_facts.packages[package] }} is defined" + - ansible_facts.packages[package] is defined fail_msg: "Package {{ package }} has not been installed." success_msg: "Package {{ package }} has been installed." loop: "{{ dbt3_db_pkg_list }}" diff --git a/roles/setup_dbt7/tasks/validate_setup_dbt7.yml b/roles/setup_dbt7/tasks/validate_setup_dbt7.yml index 4e308074b..fd1d2df6c 100644 --- a/roles/setup_dbt7/tasks/validate_setup_dbt7.yml +++ b/roles/setup_dbt7/tasks/validate_setup_dbt7.yml @@ -11,7 +11,7 @@ - name: Check that all packages in dbt7_db_pkg_list has been installed ansible.builtin.assert: that: - - "{{ ansible_facts.packages[package] }} is defined" + - ansible_facts.packages[package] is defined fail_msg: "Package {{ package }} has not been installed." success_msg: "Package {{ package }} has been installed." loop: "{{ dbt7_db_pkg_list }}" diff --git a/roles/setup_efm/defaults/main.yml b/roles/setup_efm/defaults/main.yml index 4fbca341b..fc73ff8ad 100644 --- a/roles/setup_efm/defaults/main.yml +++ b/roles/setup_efm/defaults/main.yml @@ -27,6 +27,8 @@ primary_public_ip: "" primary_private_ip: "" input_password: "" pg_allow_ip_addresses: [] +ping_server_ip: "8.8.8.8" +efm_user_email: "unknown@gmail.com" # setting validate_only to true allows you to validate setup on an existing node # use_validation flag applies to deployment configuration and validation after setup @@ -46,7 +48,7 @@ efm_default_parameters: - {name: db.bin, value: "{{ pg_bin_path }}"} - {name: db.recovery.dir, value: "{{ pg_data }}"} - {name: db.data.dir, value: "{{ pg_data }}"} - - {name: user.email, value: "unknown@gmail.com"} + - {name: user.email, value: "{{ efm_user_email }}"} - {name: auto.allow.hosts, value: true} - {name: stable.nodes.file, value: true} - {name: local.period, value: "3"} @@ -55,6 +57,7 @@ efm_default_parameters: - {name: remote.timeout, value: "5"} - {name: node.timeout, value: "5"} - {name: admin.port, value: "{{ efm_admin_port }}"} + - {name: ping.server.ip, value: "{{ ping_server_ip }}"} efm_physical_slot_param: - {name: update.physical.slots.period, value: "5"} @@ -109,6 +112,8 @@ pcp_passfile_group: "efm" pcp_passfile_mode: "0600" pgpool2_pcp_port: 9898 detach_on_agent_failure: true +efm_pgpool2_lb_attach: "{{ efm_bin_path }}/pcp_attach_all.sh %h %t" +efm_pgpool2_lb_detach: "" supported_os: - CentOS7 diff --git a/roles/setup_efm/tasks/efm_configure.yml b/roles/setup_efm/tasks/efm_configure.yml index 75bce5c57..b1d439326 100644 --- a/roles/setup_efm/tasks/efm_configure.yml +++ b/roles/setup_efm/tasks/efm_configure.yml @@ -40,13 +40,20 @@ - name: Prepare parameters for PgPoolII integration ansible.builtin.set_fact: efm_lb_parameters: - - {name: script.load.balancer.attach, value: "{{ efm_bin_path }}/pcp_attach_all.sh %h %t"} - {name: auto.resume.period, value: "5"} - {name: script.custom.monitor, value: "{{ efm_bin_path }}/pg_pcp_health.sh"} - {name: custom.monitor.interval, value: "5"} - {name: custom.monitor.safe.mode, value: "true"} - {name: custom.monitor.timeout, value: "10"} - {name: detach.on.agent.failure, value: "{{ detach_on_agent_failure }}"} + - {name: pgpool.enable, value: "{{ efm_pgpool2_integration | lower }}"} + - {name: pgpool.bin, value: "{{ pgpool2_bin_path }}"} + - {name: pcp.user, value: "{{ pcp_admin_user }}"} + - {name: pcp.host, value: "{{ pgpool2_vip }}"} + - {name: pcp.port, value: "{{ pgpool2_pcp_port }}"} + - {name: pcp.pass.file, value: "{{ pcp_passfile }}"} + - {name: script.load.balancer.attach, value: "{{ efm_pgpool2_lb_attach }}"} + - {name: script.load.balancer.detach, value: "{{ efm_pgpool2_lb_detach }}"} when: - efm_pgpool2_integration diff --git a/roles/setup_efm/tasks/validate_setup_efm.yml b/roles/setup_efm/tasks/validate_setup_efm.yml index 83f301ea0..639727095 100644 --- a/roles/setup_efm/tasks/validate_setup_efm.yml +++ b/roles/setup_efm/tasks/validate_setup_efm.yml @@ -55,7 +55,7 @@ - name: Check that all required packages have been installed on RedHat ansible.builtin.assert: that: - - "{{ ansible_facts.packages[item] }} is defined" + - ansible_facts.packages[item] is defined fail_msg: "Package {{ item }} has not been installed." success_msg: "Package {{ item }} has been installed." loop: @@ -66,7 +66,7 @@ - name: Check that all required packages have been installed on Debian ansible.builtin.assert: that: - - "{{ ansible_facts.packages[item] }} is defined" + - ansible_facts.packages[item] is defined fail_msg: "Package {{ item }} has not been installed." success_msg: "Package {{ item }} has been installed." loop: diff --git a/roles/setup_pemserver/tasks/validate_setup_pemserver.yml b/roles/setup_pemserver/tasks/validate_setup_pemserver.yml index 1d461a232..290411539 100644 --- a/roles/setup_pemserver/tasks/validate_setup_pemserver.yml +++ b/roles/setup_pemserver/tasks/validate_setup_pemserver.yml @@ -67,7 +67,7 @@ - name: Check that all required packages have been installed ansible.builtin.assert: that: - - "{{ ansible_facts.packages[item] }} is defined" + - ansible_facts.packages[item] is defined fail_msg: "Package {{ item }} has not been installed." success_msg: "Package {{ item }} has been installed." loop: "{{ pem_server_packages }}" diff --git a/roles/setup_pgpool2/tasks/pgpool2_install.yml b/roles/setup_pgpool2/tasks/pgpool2_install.yml index ddb18c734..a32b4e71d 100644 --- a/roles/setup_pgpool2/tasks/pgpool2_install.yml +++ b/roles/setup_pgpool2/tasks/pgpool2_install.yml @@ -29,7 +29,7 @@ - name: Install pgpool-II-pcp package on RedHat ansible.builtin.package: - name: "pgpool-II-pcp" + name: "{{ pgpool2_pcp_package_name }}" state: present when: - ansible_os_family == 'RedHat' diff --git a/roles/setup_pgpool2/tasks/validate_setup_pgpool2.yml b/roles/setup_pgpool2/tasks/validate_setup_pgpool2.yml index 738d0be2e..d3d8d9781 100644 --- a/roles/setup_pgpool2/tasks/validate_setup_pgpool2.yml +++ b/roles/setup_pgpool2/tasks/validate_setup_pgpool2.yml @@ -55,7 +55,7 @@ - name: Check that all required pgpool2 packages have been installed ansible.builtin.assert: that: - - "{{ ansible_facts.packages[package] }} is defined" + - ansible_facts.packages[package] is defined fail_msg: "Package {{ package }} has not been installed." success_msg: "Package {{ package }} has been installed." loop: "{{ pgpool2_packages_check }}" @@ -123,6 +123,7 @@ pg_database: "{{ pg_pgpool_database }}" no_log: "{{ disable_logging }}" when: pgpool2_test_user_password|length > 1 + run_once: true - name: Add pgpool2_test_user ansible.builtin.include_role: @@ -181,6 +182,7 @@ state: absent no_log: "{{ disable_logging }}" when: pgpool2_test_user_password|length > 1 + run_once: true - name: Remove pgpool2_test_user from pgpool2 ansible.builtin.include_role: diff --git a/roles/setup_pgpool2/vars/PG_RedHat.yml b/roles/setup_pgpool2/vars/PG_RedHat.yml index c898441d6..dda4ab853 100644 --- a/roles/setup_pgpool2/vars/PG_RedHat.yml +++ b/roles/setup_pgpool2/vars/PG_RedHat.yml @@ -2,6 +2,7 @@ pgpool2_version: 4.3 # We don't have the choice of the version with community PostgreSQL pgpool2_package_name: "pgpool-II" +pgpool2_pcp_package_name: "pgpool-II-pcp" pgpool2_configuration_file: "/etc/pgpool-II/pgpool.conf" pgpool2_pool_passwd_file: "/etc/pgpool-II/pool_passwd" pgpool2_user: "postgres"