Skip to content

Commit 6d74ce5

Browse files
committed
fix(setup-pgbackrest.yml): allow postgres user to run pgbackrest cmds
1 parent 865da58 commit 6d74ce5

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

ansible/tasks/setup-pgbackrest.yml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,22 @@
1717
when:
1818
- nixpkg_mode
1919

20-
- name: Allow pgBackRest to run commands
21-
ansible.builtin.copy:
20+
- name: Allow postgres to run pgBackRest commands as pgbackrest
21+
ansible.builtin.lineinfile:
22+
create: yes
23+
line: 'postgres ALL=(pgbackrest) NOPASSWD: /usr/bin/pgbackrest'
2224
dest: /etc/sudoers.d/pgbackrest
23-
owner: root
24-
group: root
2525
mode: '0440'
26-
content: |
27-
pgbackrest ALL=(ALL) NOPASSWD: /usr/bin/pgbackrest
26+
path: '/etc/sudoers.d/pgbackrest'
27+
validate: 'visudo -cf %s'
28+
29+
- name: Configure sudoers for pgBackRest
30+
ansible.builtin.lineinfile:
31+
create: yes
32+
line: 'postgres ALL=(pgbackrest) NOPASSWD: /var/lib/pgbackrest/.nix-profile/bin/pgbackrest'
33+
mode: '0440'
34+
path: '/etc/sudoers.d/pgbackrest'
35+
validate: 'visudo -cf %s'
2836

2937
- name: Install pgBackRest
3038
ansible.builtin.shell: |
@@ -77,14 +85,6 @@
7785
when:
7886
- stage2_nix
7987

80-
- name: Configure sudoers for pgBackRest
81-
ansible.builtin.lineinfile:
82-
create: yes
83-
line: 'postgres ALL=(pgbackrest) NOPASSWD: /var/lib/pgbackrest/.nix-profile/bin/pgbackrest'
84-
mode: '0440'
85-
path: '/etc/sudoers.d/pgbackrest'
86-
validate: 'visudo -cf %s'
87-
8888
- name: Create pgBackRest wrapper script
8989
ansible.builtin.copy:
9090
content: |

0 commit comments

Comments
 (0)