Skip to content

Commit 5593d69

Browse files
committed
Update stanza_create.yml
1 parent 636abaf commit 5593d69

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

automation/roles/pgbackrest/tasks/stanza_create.yml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,7 @@
4040
run_once: true
4141
ansible.builtin.set_fact:
4242
repo1_path: "{{ pgbackrest_server_conf['global'] | selectattr('option', 'equalto', 'repo1-path') | map(attribute='value') | list | first }}"
43-
when:
44-
- (pgbackrest_repo_type | default('posix')) | lower == 'posix'
45-
- pgbackrest_delegate is not none
43+
when: (pgbackrest_repo_type | default('posix')) | lower == 'posix'
4644

4745
- name: "Make sure the {{ repo1_path | default('') }} directory exists"
4846
delegate_to: "{{ pgbackrest_delegate }}"
@@ -53,9 +51,7 @@
5351
owner: "{{ pgbackrest_repo_user }}"
5452
group: "{{ pgbackrest_repo_user }}"
5553
mode: "0750"
56-
when:
57-
- pgbackrest_delegate is not none
58-
- repo1_path | default('') | length > 0
54+
when: repo1_path | default('') | length > 0
5955

6056
- name: Create stanza "{{ pgbackrest_stanza | default('') }}"
6157
become: true
@@ -67,9 +63,8 @@
6763
changed_when:
6864
- stanza_create_result.rc == 0
6965
- stanza_create_result.stdout is not search("already exists")
70-
when: pgbackrest_delegate is not none
7166
vars:
72-
pgbackrest_delegate: "{{ (groups.get('pgbackrest') or [None])[0] }}"
67+
pgbackrest_delegate: "{{ (groups.get('pgbackrest') | default([]) | first) | default(inventory_hostname) }}"
7368
when:
7469
- pgbackrest_repo_host | default('') | length > 0
7570
- groups.get('pgbackrest', []) | length > 0

0 commit comments

Comments
 (0)