support enable/disable backups

This commit is contained in:
ace
2024-05-26 17:59:12 +03:00
parent b183d7441c
commit 4ae6dc8311
12 changed files with 26 additions and 46 deletions

View File

@ -19,4 +19,4 @@
enabled: no
masked: no
daemon_reload: yes
when: not backup_service.changed
when: backup_service.changed

View File

@ -10,6 +10,5 @@
name: backup.timer
enabled: "{{ 'yes' if wal_g_backup_enable else 'no' }}"
masked: no
state: started
state: "{{ 'started' if wal_g_backup_enable else 'stopped' }}"
daemon_reload: yes
when: not backup_timer.changed

View File

@ -19,4 +19,4 @@
enabled: no
masked: no
daemon_reload: yes
when: not backup_permanent_service.changed
when: backup_permanent_service.changed

View File

@ -8,8 +8,7 @@
- name: Enable and start systemd backup permanent timer
systemd:
name: backup-permanent.timer
enabled: "{{ 'yes' if wal_g_backup_enable else 'no' }}"
enabled: "{{ 'yes' if wal_g_backup_permanent_enable else 'no' }}"
masked: no
state: started
state: "{{ 'started' if wal_g_backup_permanent_enable else 'stopped' }}"
daemon_reload: yes
when: not backup_permanent_timer.changed

View File

@ -19,5 +19,4 @@
enabled: no
masked: no
daemon_reload: yes
when: not backup_retention_service.changed
when: backup_retention_service.changed

View File

@ -8,8 +8,7 @@
- name: Enable and start systemd backup retention timer
systemd:
name: backup-retention.timer
enabled: "{{ 'yes' if wal_g_backup_enable else 'no' }}"
enabled: "{{ 'yes' if wal_g_backup_retention_enable else 'no' }}"
masked: no
state: started
state: "{{ 'started' if wal_g_backup_retention_enable else 'stopped' }}"
daemon_reload: yes
when: not backup_retention_timer.changed

View File

@ -17,40 +17,22 @@
- name: "Include install WAL-G {{ wal_g_version }} for PostgreSQL"
include_tasks: pg.yaml
when: wal_g_pg
- name: "Include backup job with WAL-G {{ wal_g_version }} for PostgreSQL"
include_tasks: backup_job.yaml
when:
- wal_g_pg
- name: "Include backup job timer with WAL-G {{ wal_g_version }} for PostgreSQL"
include_tasks: backup_job_timer.yaml
when:
- wal_g_pg
- wal_g_backup_schedule is defined
- wal_g_backup_schedule | length > 0
- name: "Include backup retention job with WAL-G {{ wal_g_version }} for PostgreSQL"
include_tasks: backup_retention_job.yaml
when:
- wal_g_pg
- name: "Include backup retention job timer with WAL-G {{ wal_g_version }} for PostgreSQL"
include_tasks: backup_retention_job_timer.yaml
when:
- wal_g_pg
- wal_g_backup_retention_schedule is defined
- wal_g_backup_retention_schedule | length > 0
- name: "Include permanent backup job with WAL-G {{ wal_g_version }} for PostgreSQL"
include_tasks: backup_permanent_job.yaml
when:
- wal_g_pg
- name: "Include permanent backup job timer with WAL-G {{ wal_g_version }} for PostgreSQL"
include_tasks: backup_permanent_job_timer.yaml
when:
- wal_g_pg
- wal_g_backup_permanent_schedule is defined
- wal_g_backup_permanent_schedule | length > 0
- name: "Include backup retention job with WAL-G {{ wal_g_version }} for PostgreSQL"
include_tasks: backup_retention_job.yaml
- name: "Include backup retention job timer with WAL-G {{ wal_g_version }} for PostgreSQL"
include_tasks: backup_retention_job_timer.yaml