diff --git a/roles/haproxy/tasks/main.yml b/roles/haproxy/tasks/main.yml index d41f016d5..93f408e14 100644 --- a/roles/haproxy/tasks/main.yml +++ b/roles/haproxy/tasks/main.yml @@ -1,6 +1,6 @@ --- -- name: Gather facts for hosts postres_cluster +- name: Gather facts from postgres_cluster hosts ansible.builtin.setup: delegate_to: "{{ item }}" delegate_facts: true diff --git a/roles/upgrade/tasks/maintenance_disable.yml b/roles/upgrade/tasks/maintenance_disable.yml index 38a80bbd4..65936259b 100644 --- a/roles/upgrade/tasks/maintenance_disable.yml +++ b/roles/upgrade/tasks/maintenance_disable.yml @@ -8,20 +8,30 @@ dest: /etc/haproxy/haproxy.cfg owner: haproxy group: haproxy + delegate_to: "{{ item }}" + loop: "{{ groups.balancers | default([]) | list }}" + run_once: true - name: Reload haproxy service ansible.builtin.systemd: name: haproxy state: reloaded + delegate_to: "{{ item }}" + loop: "{{ groups.balancers | default([]) | list }}" + run_once: true - name: Start confd service ansible.builtin.service: name: confd state: started + delegate_to: "{{ item }}" + loop: "{{ groups.balancers | default([]) | list }}" + run_once: true become: true become_user: root ignore_errors: true # show the error and continue the playbook execution when: + - groups.balancers | default([]) | length > 0 - with_haproxy_load_balancing | bool - pgbouncer_install | bool - pgbouncer_pool_pause | bool diff --git a/roles/upgrade/tasks/maintenance_enable.yml b/roles/upgrade/tasks/maintenance_enable.yml index 1a560b892..6317acc64 100644 --- a/roles/upgrade/tasks/maintenance_enable.yml +++ b/roles/upgrade/tasks/maintenance_enable.yml @@ -16,10 +16,20 @@ # Temporarily disable http-checks in order to keep database connections after stopping the Patroni service # and then pause the pgbouncer pools. - block: + - name: Gather facts from balancers + ansible.builtin.setup: + delegate_to: "{{ item }}" + delegate_facts: true + loop: "{{ groups.balancers | default([]) | list }}" + run_once: true + - name: Stop confd service ansible.builtin.service: name: confd state: stopped + delegate_to: "{{ item }}" + loop: "{{ groups.balancers | default([]) | list }}" + run_once: true when: dcs_type == "etcd" - name: Update haproxy conf file (disable http-checks) @@ -28,14 +38,21 @@ dest: /etc/haproxy/haproxy.cfg owner: haproxy group: haproxy + delegate_to: "{{ item }}" + loop: "{{ groups.balancers | default([]) | list }}" + run_once: true - name: Reload haproxy service ansible.builtin.systemd: name: haproxy state: reloaded + delegate_to: "{{ item }}" + loop: "{{ groups.balancers | default([]) | list }}" + run_once: true become: true become_user: root when: + - groups.balancers | default([]) | length > 0 - with_haproxy_load_balancing | bool - pgbouncer_install | bool - pgbouncer_pool_pause | bool diff --git a/roles/upgrade/tasks/update_config.yml b/roles/upgrade/tasks/update_config.yml index a680f5354..0e96ff120 100644 --- a/roles/upgrade/tasks/update_config.yml +++ b/roles/upgrade/tasks/update_config.yml @@ -7,6 +7,12 @@ dest: "{{ patroni_config_file }}.bkp" remote_src: true +# https://github.com/vitabaks/postgresql_cluster/issues/666 +- name: Remove patroni.dynamic.json file + ansible.builtin.file: + path: "{{ pg_old_datadir }}/patroni.dynamic.json" + state: absent + # Update the directory path to a new version of PostgresSQL - name: "Edit patroni.yml | update parameters: data_dir, bin_dir, config_dir" ansible.builtin.replace: