1
0
Fork 0
mirror of https://github.com/roles-ansible/role-postgresql-backup.git synced 2024-08-16 10:19:49 +02:00
role-postgresql-backup/tasks/main.yml

29 lines
825 B
YAML
Raw Normal View History

2020-07-08 14:01:03 +02:00
---
- name: combine postgresql_backup configuration
set_fact:
ranger: "{{ _postgresql_backup|combine(postgresql_backup, recursive=True) }}"
- include_tasks: versioncheck.yml
when: submodules_versioncheck|bool
2020-07-08 15:45:38 +02:00
- include_tasks: packages.yml
2020-07-08 17:22:41 +02:00
- name: generate backup script
become: true
template:
src: templates/postgresql-backup-script.sh
2020-07-09 10:45:12 +02:00
dest: /opt/postgresql-backup-script.sh
2020-07-08 17:22:41 +02:00
owner: "{{ postgresql_backup.user }}"
backup: true
mode: 0755
2020-07-08 17:46:14 +02:00
- 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' ) }}"
2020-07-09 10:45:12 +02:00
job: /etc/postgresql-backup-script.sh >/dev/null 2>&1
2020-07-08 17:46:14 +02:00
user: "{{ postgresql_backup.user }}"