mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-08-29 15:06:26 +02:00
Optimized logic for database backups and integrated test to verify that database feature is used correct
This commit is contained in:
@@ -16,4 +16,4 @@
|
||||
when: applications | get_app_conf(application_id, 'features.central_database', False)
|
||||
|
||||
- name: "For '{{ application_id }}': Add Entry for Backup Procedure"
|
||||
include_tasks: "{{ playbook_dir }}/roles/sys-bkp-docker-2-loc/tasks/seed-database-to-backup.yml"
|
||||
include_tasks: "{{ playbook_dir }}/roles/sys-bkp-docker-2-loc/tasks/03_seed-database-to-backup.yml"
|
||||
|
@@ -2,7 +2,7 @@
|
||||
application_id: "svc-prx-openresty"
|
||||
|
||||
# Deactivate Database for openresty
|
||||
database_type: false
|
||||
database_enabled: false
|
||||
|
||||
# Openresty
|
||||
openresty_image: "openresty/openresty"
|
||||
|
1
roles/sys-bkp-docker-2-loc/defaults/main.yml
Normal file
1
roles/sys-bkp-docker-2-loc/defaults/main.yml
Normal file
@@ -0,0 +1 @@
|
||||
database_enabled: "{{ database_type | default('') | bool }}" # Enables the database backup
|
17
roles/sys-bkp-docker-2-loc/tasks/01_pkgmgr_routines.yml
Normal file
17
roles/sys-bkp-docker-2-loc/tasks/01_pkgmgr_routines.yml
Normal file
@@ -0,0 +1,17 @@
|
||||
- block:
|
||||
- name: "pkgmgr install {{ bkp_docker_to_local_pkg }}"
|
||||
include_role:
|
||||
name: pkgmgr-install
|
||||
vars:
|
||||
package_name: "{{ bkp_docker_to_local_pkg }}"
|
||||
|
||||
- name: "Retrieve {{ bkp_docker_to_local_pkg }} path from pkgmgr"
|
||||
command: "pkgmgr path {{ bkp_docker_to_local_pkg }}"
|
||||
register: pkgmgr_output
|
||||
changed_when: false
|
||||
|
||||
- name: Set fact for backup_docker_to_local_folder
|
||||
set_fact:
|
||||
backup_docker_to_local_folder: "{{ pkgmgr_output.stdout }}/"
|
||||
changed_when: false
|
||||
when: backup_docker_to_local_folder is not defined
|
@@ -1,4 +1,5 @@
|
||||
# This file is also used by web-app-matrix
|
||||
- include_tasks: 01_pkgmgr_routines.yml
|
||||
when: backup_docker_to_local_folder is not defined
|
||||
|
||||
- name: "Display all database variables"
|
||||
debug:
|
@@ -1,22 +1,9 @@
|
||||
- block:
|
||||
- name: "pkgmgr install"
|
||||
include_role:
|
||||
name: pkgmgr-install
|
||||
vars:
|
||||
package_name: "{{ bkp_docker_to_local_pkg }}"
|
||||
|
||||
- name: "Retrieve {{ bkp_docker_to_local_pkg }} path from pkgmgr"
|
||||
command: "pkgmgr path {{ bkp_docker_to_local_pkg }}"
|
||||
register: pkgmgr_output
|
||||
changed_when: false
|
||||
|
||||
- name: Set fact for backup_docker_to_local_folder
|
||||
set_fact:
|
||||
backup_docker_to_local_folder: "{{ pkgmgr_output.stdout }}/"
|
||||
changed_when: false
|
||||
- include_tasks: 01_pkgmgr_routines.yml
|
||||
when: backup_docker_to_local_folder is not defined
|
||||
|
||||
- name: "reset (if enabled)"
|
||||
include_tasks: reset.yml
|
||||
include_tasks: 02_reset.yml
|
||||
when: mode_reset | bool
|
||||
|
||||
- name: configure sys-bkp-docker-2-loc-everything.infinito.service
|
||||
@@ -41,15 +28,12 @@
|
||||
vars:
|
||||
on_calendar: "{{on_calendar_backup_docker_to_local}}"
|
||||
|
||||
- name: run the backup_docker_to_local tasks once
|
||||
set_fact:
|
||||
run_once_sys_bkp_docker_2_loc: true
|
||||
|
||||
- include_tasks: "{{ playbook_dir }}/tasks/utils/load_handlers.yml"
|
||||
when:
|
||||
- run_once_sys_bkp_docker_2_loc is not defined
|
||||
- database_type is defined and database_type
|
||||
- database_enabled | bool
|
||||
|
||||
- name: "include seed-database-to-backup.yml"
|
||||
include_tasks: seed-database-to-backup.yml
|
||||
- name: "include 03_seed-database-to-backup.yml"
|
||||
include_tasks: 03_seed-database-to-backup.yml
|
||||
when:
|
||||
- database_type is defined and database_type
|
||||
- database_enabled | bool
|
||||
|
@@ -7,7 +7,7 @@ features:
|
||||
# @todo fix this
|
||||
ldap: false
|
||||
oidc: true
|
||||
central_database: false
|
||||
central_database: false # Propably required for backup routines
|
||||
logout: true
|
||||
server:
|
||||
csp:
|
||||
@@ -20,3 +20,9 @@ server:
|
||||
canonical:
|
||||
- "meet.{{ primary_domain }}"
|
||||
credentials: {}
|
||||
|
||||
docker:
|
||||
services:
|
||||
database:
|
||||
# This is set to true to pass integration test, doesn't have any other function
|
||||
enabled: true
|
||||
|
@@ -3,8 +3,8 @@
|
||||
include_role:
|
||||
name: cmp-docker-proxy
|
||||
|
||||
- name: "include seed-database-to-backup.yml"
|
||||
include_tasks: "{{ playbook_dir }}/roles/sys-bkp-docker-2-loc/tasks/seed-database-to-backup.yml"
|
||||
- name: "include 03_seed-database-to-backup.yml"
|
||||
include_tasks: "{{ playbook_dir }}/roles/sys-bkp-docker-2-loc/tasks/03_seed-database-to-backup.yml"
|
||||
|
||||
- name: configure websocket_upgrade.conf
|
||||
copy:
|
||||
|
@@ -9,5 +9,5 @@
|
||||
name: svc-db-postgres
|
||||
when: applications | get_app_conf(application_id, 'features.central_database', False)
|
||||
|
||||
- name: "include seed-database-to-backup.yml"
|
||||
include_tasks: "{{ playbook_dir }}/roles/sys-bkp-docker-2-loc/tasks/seed-database-to-backup.yml"
|
||||
- name: "include 03_seed-database-to-backup.yml"
|
||||
include_tasks: "{{ playbook_dir }}/roles/sys-bkp-docker-2-loc/tasks/03_seed-database-to-backup.yml"
|
Reference in New Issue
Block a user