setup cron local mail reporting and longhorn recurring backup job
This commit is contained in:
@@ -25,6 +25,16 @@
|
||||
- name: test backup_cmd
|
||||
ansible.builtin.shell: |
|
||||
{{ backup_cmd }} > /dev/null
|
||||
|
||||
- name: Créer le script de backup
|
||||
copy:
|
||||
dest: "{{ scripts_dir }}/backup.sh"
|
||||
mode: '0755'
|
||||
content: |
|
||||
#!/bin/bash
|
||||
set -e
|
||||
{{ backup_cmd }} | gzip > {{ backup_dir }}/backup_$(date +\%Y\%m\%d).sql.gz
|
||||
find {{ backup_dir }} -type f -name 'backup_*.sql.gz' -mtime +{{ keep_days }} -delete
|
||||
|
||||
- name: Ajouter une tâche cron pour dump PostgreSQL tous les jours à 4h avec compression
|
||||
cron:
|
||||
@@ -32,9 +42,7 @@
|
||||
minute: "0"
|
||||
hour: "4"
|
||||
user: root
|
||||
job: >-
|
||||
{{ backup_cmd }} | gzip > {{ backup_dir }}/backup_$(date +\\%Y\\%m\\%d).sql.gz
|
||||
&& find {{ backup_dir }} -type f -name 'backup_*.sql.gz' -mtime +{{ keep_days }} -delete
|
||||
job: "{{ scripts_dir }}/backup.sh"
|
||||
|
||||
- name: Créer le script de restauration
|
||||
copy:
|
||||
|
||||
Reference in New Issue
Block a user