This commit is contained in:
Bart Sjerps
2026-06-29 09:02:59 +02:00
parent f5824e80e9
commit 9d74e2f4b1
4 changed files with 43 additions and 2 deletions
Executable
+12
View File
@@ -0,0 +1,12 @@
#!/bin/bash
cd /tmp
test -d /var/lib/pgsql || exit 0
pgrep postgres &>/dev/null || exit 10
tar -jcvf /var/backups/postgres/postgresql-config.tbz2 /var/lib/pgsql/*/data/*.conf
/usr/sbin/runuser postgres -l -s /bin/bash -c '/usr/bin/pg_dumpall > /var/backups/postgres/pgdump.sql'
+5 -2
View File
@@ -56,13 +56,16 @@
ansible.builtin.selinux:
state: disabled
- name: Create bin directory
- name: Create Directories
file:
path: /opt/atclab/bin
path: '{{ item }}'
state: directory
mode: '0755'
owner: root
group: root
loop:
- /var/backups
- /opt/atclab/bin
- name: Copy etc configs
copy:
+3
View File
@@ -50,6 +50,9 @@ atc-mgt01.dell-atc.lan
atc-nas.dell-atc.lan
atc-db01.dell-atc.lan
[postgres]
atc-db01.dell-atc.lan
[nvidia]
atc-gpu-bart.dell-atc.lan
atc-gpu-mo1.dell-atc.lan
+23
View File
@@ -0,0 +1,23 @@
---
- name: Postgres Servers
hosts: postgres
pre_tasks:
- name: Postgres Repo
ansible.builtin.dnf:
name: 'https://download.postgresql.org/pub/repos/yum/reporpms/EL-9-x86_64/pgdg-redhat-repo-latest.noarch.rpm'
state: present
tasks:
- name: Backup script
copy:
src: 'bin/pg-backup'
dest: '/usr/local/bin/pg-backup'
mode: '0755'
- name: Setup Postgres backup cron job
ansible.builtin.cron:
name: "borgmatic"
minute: 30
hour: 23
job: /usr/local/bin/pg-backup