Skip to content

Commit 56e3d22

Browse files
committed
fix(setup-pgbackrest): adjust as per Sam
1 parent e9b3216 commit 56e3d22

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

ansible/tasks/setup-pgbackrest.yml

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,20 @@
6262
loop_var: conf_item
6363
when: stage2_nix
6464

65-
- name: Symlink pgBackRest binary
66-
file:
67-
path: /usr/bin/pgbackrest
68-
src: /var/lib/pgbackrest/.nix-profile/bin/pgbackrest
69-
state: link
65+
- name: Configure sudoers for pgBackRest
66+
ansible.builtin.lineinfile:
67+
create: yes
68+
line: 'postgres ALL=(pgbackrest) NOPASSWD: /var/lib/pgbackrest/.nix-profile/bin/pgbackrest'
69+
mode: '0440'
70+
path: '/etc/sudoers.d/pgbackrest'
71+
validate: 'visudo -cf %s'
7072

71-
- name: Sticky bit the pgBackRest binary
72-
file:
73-
path: /var/lib/pgbackrest/.nix-profile/bin/pgbackrest
74-
mode: '4755'
75-
become: true
73+
- name: Create pgBackRest wrapper script
74+
ansible.builtin.copy:
75+
content: |
76+
#!/bin/bash
77+
exec sudo -u pgbackrest /var/lib/pgbackrest/.nix-profile/bin/pgbackrest "$@"
78+
dest: '/usr/bin/pgbackrest'
79+
group: 'root'
80+
mode: '0755'
81+
owner: 'root'

0 commit comments

Comments
 (0)