Skip to content

Commit af04663

Browse files
committed
fix: relocate tasks to appropriate stage`
1 parent 44812b7 commit af04663

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
@@ -136,3 +136,11 @@
136136
- name: PgBouncer - reload systemd
137137
ansible.builtin.systemd_service:
138138
daemon_reload: true
139+
140+
- name: PgBouncer - create log file
141+
ansible.builtin.file:
142+
path: '/var/log/pgbouncer.log'
143+
state: 'touch'
144+
owner: 'pgbouncer'
145+
group: 'postgres'
146+
mode: '0644'

ansible/tasks/setup-wal-g.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,3 +101,27 @@
101101
regexp: "#include = '/etc/postgresql-custom/wal-g.conf'"
102102
replace: "include = '/etc/postgresql-custom/wal-g.conf'"
103103
become: true
104+
105+
- name: Create wal-g log directory
106+
ansible.builtin.file:
107+
path: '/var/log/wal-g'
108+
state: 'directory'
109+
owner: 'postgres'
110+
group: 'postgres'
111+
mode: '0300'
112+
113+
- name: Create wal-g log files
114+
ansible.builtin.file:
115+
path: "/var/log/wal-g/{{ walg_log_item }}"
116+
state: 'touch'
117+
owner: 'postgres'
118+
group: 'postgres'
119+
mode: '0300'
120+
loop:
121+
- 'backup-push.log'
122+
- 'backup-fetch.log'
123+
- 'wal-push.log'
124+
- 'wal-fetch.log'
125+
- 'pitr.log'
126+
loop_control:
127+
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)