38 lines
770 B
YAML
38 lines
770 B
YAML
- name: Install pgBackRest
|
|
apt:
|
|
name: pgbackrest
|
|
state: present
|
|
|
|
- name: Repo dir
|
|
file:
|
|
path: /pgbackrest
|
|
state: directory
|
|
owner: postgres
|
|
mode: "750"
|
|
when: inventory_hostname in groups['replica']
|
|
|
|
- name: Config
|
|
template:
|
|
src: pgbackrest.conf.j2
|
|
dest: /etc/pgbackrest.conf
|
|
|
|
- name: Create stanza
|
|
become_user: postgres
|
|
command: pgbackrest --stanza=main stanza-create
|
|
when: inventory_hostname in groups['primary']
|
|
|
|
- name: Full backup weekly
|
|
cron:
|
|
name: "pgbackrest full"
|
|
weekday: 0
|
|
hour: 2
|
|
minute: 0
|
|
job: "pgbackrest --stanza=main backup --type=full"
|
|
|
|
- name: Incremental backup daily
|
|
cron:
|
|
name: "pgbackrest incr"
|
|
hour: 2
|
|
minute: 0
|
|
job: "pgbackrest --stanza=main backup --type=incr"
|