Files
ansible/postgres.yml
T
Bart Sjerps 6bc129ca70 fixes
2026-07-10 16:45:41 +02:00

38 lines
897 B
YAML

---
- 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
- name: Postgres RPMs
ansible.builtin.dnf:
name:
- postgresql18-server
- postgresql18-contrib
state: latest
tasks:
- name: PG Backup directory
file:
path: '/var/backups/postgres'
state: directory
mode: '0775'
owner: postgres
group: postgres
- 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: "pg-backup"
minute: 30
hour: 23
job: /usr/local/bin/pg-backup