Skip to content

Commit

Permalink
Set maintenance variable for add_pgnode.yml (#890)
Browse files Browse the repository at this point in the history
  • Loading branch information
vitabaks authored Feb 12, 2025
1 parent 8fc23eb commit a3fcfb2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 4 additions & 0 deletions automation/add_pgnode.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
ansible.builtin.include_vars: "vars/{{ ansible_os_family }}.yml"
tags: always

- name: Set maintenance variable
ansible.builtin.set_fact:
postgresql_cluster_maintenance: true

- name: "[Pre-Check] Checking Linux distribution"
ansible.builtin.fail:
msg: "{{ ansible_distribution }} is not supported"
Expand Down
10 changes: 3 additions & 7 deletions automation/roles/pre-checks/tasks/passwords.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,9 @@
- pgbouncer_install | bool
- pgbouncer_auth_user | bool
- pgbouncer_auth_password | default('') | length < 1
when:
- not (postgresql_cluster_maintenance | default(false) | bool) # exclude for config_pgcluster.yml
- not (new_node | default(false) | bool) # exclude for add_pgnode.yml
when: not (postgresql_cluster_maintenance | default(false) | bool) # exclude for config_pgcluster.yml and add_pgnode.yml

# Get current passwords (if not defined) - for config_pgcluster.yml
# Get current passwords (if not defined) - for config_pgcluster.yml and add_pgnode.yml
- block:
- name: Get patroni superuser password
ansible.builtin.shell: |
Expand Down Expand Up @@ -90,6 +88,4 @@
ansible.builtin.set_fact:
patroni_restapi_password: "{{ patroni_restapi_password_result.stdout }}"
when: patroni_restapi_password_result.stdout is defined
when:
- (postgresql_cluster_maintenance | default(false) | bool)
or (new_node | default(false) | bool) # include for add_pgnode.yml
when: postgresql_cluster_maintenance | default(false) | bool
4 changes: 2 additions & 2 deletions automation/roles/pre-checks/tasks/patroni.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
- pgdata_initialized.stat.exists
when:
- not postgresql_exists | bool
- not (postgresql_cluster_maintenance|default(false)|bool) # exclude for config_pgcluster.yml
- not (postgresql_cluster_maintenance|default(false)|bool) # exclude for config_pgcluster.yml and add_pgnode.yml

# when postgresql exists
- block:
Expand All @@ -33,4 +33,4 @@
- not pgdata_initialized.stat.exists
when:
- postgresql_exists | bool
- not (postgresql_cluster_maintenance|default(false)|bool) # exclude for config_pgcluster.yml
- not (postgresql_cluster_maintenance|default(false)|bool) # exclude for config_pgcluster.yml and add_pgnode.yml

0 comments on commit a3fcfb2

Please sign in to comment.