Skip to content

Commit 865da58

Browse files
jchancojrhunleyd
andauthored
Apply suggestions from code review
Co-authored-by: Douglas J Hunley <[email protected]>
1 parent 7a50d3b commit 865da58

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

ansible/tasks/setup-pgbackrest.yml

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
ansible.builtin.group:
33
name: pgbackrest
44
state: present
5-
when: nixpkg_mode
5+
when:
6+
- nixpkg_mode
67

78
- name: Create pgBackRest user
89
ansible.builtin.user:
@@ -13,10 +14,11 @@
1314
name: pgbackrest
1415
shell: /sbin/nologin
1516
system: true
16-
when: nixpkg_mode
17+
when:
18+
- nixpkg_mode
1719

1820
- name: Allow pgBackRest to run commands
19-
copy:
21+
ansible.builtin.copy:
2022
dest: /etc/sudoers.d/pgbackrest
2123
owner: root
2224
group: root
@@ -25,12 +27,13 @@
2527
pgbackrest ALL=(ALL) NOPASSWD: /usr/bin/pgbackrest
2628
2729
- name: Install pgBackRest
28-
become: true
29-
become_user: pgbackrest
3030
ansible.builtin.shell: |
3131
sudo -u pgbackrest bash -c ". /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh && nix profile install github:supabase/postgres/{{ git_commit_sha }}#pg-backrest"
32+
become: true
33+
become_user: pgbackrest
3234
changed_when: true
33-
when: stage2_nix
35+
when:
36+
- stage2_nix
3437

3538
- name: Create needed directories for pgBackRest
3639
ansible.legacy.file:
@@ -46,7 +49,8 @@
4649
- /var/log/pgbackrest
4750
loop_control:
4851
loop_var: backrest_dir
49-
when: nixpkg_mode
52+
when:
53+
- nixpkg_mode
5054

5155
- name: Symlink pgbackrest.conf
5256
ansible.legacy.file:
@@ -70,7 +74,8 @@
7074
- {name: repo1.conf, path: conf.d}
7175
loop_control:
7276
loop_var: conf_item
73-
when: stage2_nix
77+
when:
78+
- stage2_nix
7479

7580
- name: Configure sudoers for pgBackRest
7681
ansible.builtin.lineinfile:

0 commit comments

Comments
 (0)