Skip to content

Commit

Permalink
update condition
Browse files Browse the repository at this point in the history
  • Loading branch information
vitabaks committed Nov 1, 2024
1 parent 28efdc3 commit 3540d14
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions automation/roles/patroni/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -767,7 +767,7 @@
tags: patroni, point_in_time_recovery

- block: # PITR (custom bootstrap) - disable archive_command
- name: Check the patroni.dynamic.json exists
- name: Check if patroni.dynamic.json exists
ansible.builtin.stat:
path: "{{ postgresql_data_dir }}/patroni.dynamic.json"
register: patroni_dynamic_json
Expand All @@ -777,27 +777,33 @@
ansible.builtin.file:
path: "{{ postgresql_data_dir }}/patroni.dynamic.json"
state: absent
when: patroni_dynamic_json is defined and
patroni_dynamic_json.stat.exists
when:
- patroni_dynamic_json is defined
- patroni_dynamic_json.stat is defined
- patroni_dynamic_json.stat.exists

- name: Edit patroni.dynamic.json | disable archive_command (if enabled)
yedit:
src: "{{ postgresql_data_dir }}/patroni.dynamic.json"
key: postgresql.parameters.archive_command
value: "cd ." # not doing anything yet with WAL-s
content_type: json
when: patroni_dynamic_json.stat.exists and
keep_patroni_dynamic_json|bool and disable_archive_command|bool
when:
- disable_archive_command | bool
- patroni_dynamic_json is defined
- patroni_dynamic_json.stat is defined
- patroni_dynamic_json.stat.exists
- keep_patroni_dynamic_json | bool

- name: Edit patroni.yml | disable archive_command (if enabled)
yedit:
src: /etc/patroni/patroni.yml
key: bootstrap.dcs.postgresql.parameters.archive_command
value: "cd ." # not doing anything yet with WAL-s
when: disable_archive_command|bool
when: disable_archive_command | bool
when: patroni_cluster_bootstrap_method != "initdb" and
(pgbackrest_install|bool or wal_g_install|bool) and
(existing_pgcluster is not defined or not existing_pgcluster|bool)
(pgbackrest_install | bool or wal_g_install | bool) and
(existing_pgcluster is not defined or not existing_pgcluster | bool)
become: true
become_user: postgres
tags: patroni, point_in_time_recovery
Expand Down

0 comments on commit 3540d14

Please sign in to comment.