Run postgresql backuper

It only creates database dumps, but does not send them anywhere yet.
This commit is contained in:
Ivan R. 2024-11-23 19:29:47 +05:00
parent 1193103f2b
commit 2c3048d510
Signed by: lumin
GPG key ID: E0937DC7CD6D3817
4 changed files with 37 additions and 0 deletions

4
backups.yml Normal file
View file

@ -0,0 +1,4 @@
- hosts: webservers
roles:
- name: backups
postgres_password: "{{ postgresql_users.postgres }}"

View file

@ -0,0 +1,6 @@
argument_specs:
main:
options:
postgres_password:
type: str
required: true

View file

@ -0,0 +1,26 @@
- name: Copy pgpass file
become: true
ansible.builtin.template:
src: pgpass.j2
dest: /root/.pgpass
mode: "0600"
owner: root
- name: Create postgresql backups volume
become: true
community.docker.docker_volume:
name: postgresql-backups
- name: Run postgresql backuper
become: true
community.docker.docker_container:
name: postgresql-backuper-1
image: git.comfycamp.space/lumin/postgresql-backuper:v0.0.3
volumes:
- postgresql-backups:/backups
- /root/.pgpass:/root/.pgpass:ro
env:
CUSTOM_ARGS: "-U postgres -h postgresql --no-password"
BACKUPS_DIR: /backups
BACKUP_INTERVAL: 24h
networks:
- name: postgresql
restart_policy: unless-stopped

View file

@ -0,0 +1 @@
postgresql:5432:*:postgres:{{ postgres_password }}