mirror of
https://github.com/roles-ansible/role-postgresql-backup.git
synced 2024-08-16 10:19:49 +02:00
29 lines
870 B
YAML
29 lines
870 B
YAML
---
|
|
- name: combine postgresql_backup configuration
|
|
set_fact:
|
|
postgresql_backup: "{{ _postgresql_backup|combine(postgresql_backup, recursive=True) }}"
|
|
|
|
- include_tasks: versioncheck.yml
|
|
when: submodules_versioncheck|bool
|
|
|
|
- include_tasks: packages.yml
|
|
|
|
- name: generate backup script
|
|
become: true
|
|
template:
|
|
src: templates/postgresql-backup-script.sh.j2
|
|
dest: /opt/postgresql-backup-script.sh
|
|
owner: "{{ postgresql_backup.user }}"
|
|
backup: true
|
|
mode: 0755
|
|
|
|
- name: add backup script as cronjob
|
|
become: true
|
|
cron:
|
|
name: backup postgres database
|
|
cron_file: /etc/crontab
|
|
minute: "{{ postgresql_backup.cron_minute | default( '*' ) }}"
|
|
hour: "{{ postgresql_backup.cron_hour | default( '0' ) }}"
|
|
job: /opt/postgresql-backup-script.sh >/dev/null 2>&1
|
|
user: "{{ postgresql_backup.user }}"
|
|
when: postgresql_backup.cron
|