Files
ansible/roles/postgres/tasks/main.yml
VC acb5845192
All checks were successful
ansible-lint / lint-everything (push) Successful in 1m28s
♻: move pgsql data dir to standard
2025-03-22 13:23:50 +01:00

37 lines
807 B
YAML

---
- name: Install python library
ansible.builtin.package:
name: python3-psycopg2
state: present
update_cache: true
- name: Install postgresql
ansible.builtin.package:
name: postgresql
state: present
update_cache: true
- name: Put hba configuration files
ansible.builtin.copy:
src: "files/pg_hba.conf"
dest: "/etc/postgresql/{{ postgres_pg_version }}/main/pg_hba.conf"
mode: "0o640"
notify: Restart postgres
- name: Create backup dir
ansible.builtin.file:
path: /srv/backup/pgsql
owner: postgres
group: postgres
state: directory
mode: "0o755"
- name: Cron backup script
ansible.builtin.cron:
user: postgres
minute: "0"
hour: "4"
name: PG Backup
job: "/usr/bin/pg_dumpall | gzip -c > /srv/backup/pgsql/all.dbs.gz"