Skip to content

Commit 3bf7884

Browse files
committed
fix: relocate tasks to appropriate stage`
1 parent f515a1a commit 3bf7884

File tree

3 files changed

+36
-20
lines changed

3 files changed

+36
-20
lines changed

ansible/tasks/setup-pgbouncer.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,3 +135,11 @@
135135
- name: PgBouncer - reload systemd
136136
ansible.builtin.systemd_service:
137137
daemon_reload: true
138+
139+
- name: PgBouncer - create log file
140+
ansible.builtin.file:
141+
path: '/var/log/pgbouncer.log'
142+
state: 'touch'
143+
owner: 'pgbouncer'
144+
group: 'postgres'
145+
mode: '0644'

ansible/tasks/setup-wal-g.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,27 @@
8383
regexp: "#include = '/etc/postgresql-custom/wal-g.conf'"
8484
replace: "include = '/etc/postgresql-custom/wal-g.conf'"
8585
become: true
86+
87+
- name: Create wal-g log directory
88+
ansible.builtin.file:
89+
path: '/var/log/wal-g'
90+
state: 'directory'
91+
owner: 'postgres'
92+
group: 'postgres'
93+
mode: '0300'
94+
95+
- name: Create wal-g log files
96+
ansible.builtin.file:
97+
path: "/var/log/wal-g/{{ walg_log_item }}"
98+
state: 'touch'
99+
owner: 'postgres'
100+
group: 'postgres'
101+
mode: '0300'
102+
loop:
103+
- 'backup-push.log'
104+
- 'backup-fetch.log'
105+
- 'wal-push.log'
106+
- 'wal-fetch.log'
107+
- 'pitr.log'
108+
loop_control:
109+
loop_var: 'walg_log_item'

ebssurrogate/scripts/surrogate-bootstrap-nix.sh

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -337,29 +337,13 @@ function clean_system {
337337
# https://github.com/fail2ban/fail2ban/issues/1593
338338
touch /mnt/var/log/auth.log
339339

340-
touch /mnt/var/log/pgbouncer.log
341-
if [ -f /usr/bin/chown ]; then
342-
chroot /mnt /usr/bin/chown pgbouncer:postgres /var/log/pgbouncer.log
343-
fi
344-
345-
# Setup postgresql logs
346-
mkdir -p /mnt/var/log/postgresql
347-
if [ -f /usr/bin/chown ]; then
348-
chroot /mnt /usr/bin/chown postgres:postgres /var/log/postgresql
349-
fi
340+
# Note: pgbouncer, postgresql, and wal-g log setup moved to ansible tasks
341+
# (setup-pgbouncer.yml, setup-postgres.yml, setup-wal-g.yml)
342+
# because those users don't exist in the Stage 1 base image
350343

351-
# Setup wal-g logs
352-
mkdir /mnt/var/log/wal-g
353-
touch /mnt/var/log/wal-g/{backup-push.log,backup-fetch.log,wal-push.log,wal-fetch.log,pitr.log}
354-
355-
#Creatre Sysstat directory for SAR
344+
# Create Sysstat directory for SAR
356345
mkdir /mnt/var/log/sysstat
357346

358-
if [ -f /usr/bin/chown ]; then
359-
chroot /mnt /usr/bin/chown -R postgres:postgres /var/log/wal-g
360-
chroot /mnt /usr/bin/chmod -R 0300 /var/log/wal-g
361-
fi
362-
363347
# audit logs directory for apparmor
364348
mkdir /mnt/var/log/audit
365349

0 commit comments

Comments
 (0)