Refactor database path variables in Ansible and Terraform playbooks; add local database folder variable

This commit is contained in:
2025-01-12 15:15:16 +01:00
parent 7eae07ddb6
commit e8710ea134
12 changed files with 61 additions and 50 deletions
@@ -85,7 +85,7 @@ resource "kubernetes_deployment" "deployment" {
command = ["sh", "-c", "mysqladmin status -uroot -p$MARIADB_ROOT_PASSWORD"]
}
initial_delay_seconds = 30
period_seconds = 10
period_seconds = 300
timeout_seconds = 1
failure_threshold = 15
}
@@ -151,13 +151,13 @@ resource "kubernetes_deployment" "deployment" {
volume {
name = "persistent-storage"
host_path {
path = "${var.host_storage_path}/${var.app_name}.data"
path = "${var.database_folder}/${var.app_name}.data"
}
}
volume {
name = "initdb-storage"
host_path {
path = "${var.host_storage_path}/${var.app_name}.initdb.d"
path = "${var.database_folder}/${var.app_name}.initdb.d"
}
}
}
@@ -231,7 +231,7 @@ resource "kubernetes_cron_job_v1" "backup_data_cron" {
volume {
name = "backups-storage"
host_path {
path = "${var.host_storage_path}/${var.app_backup_folder}"
path = var.backup_folder
}
}
restart_policy = "Never"
@@ -22,7 +22,7 @@ variable "app_password" {
type = string
}
variable "host_storage_path" {
variable "database_folder" {
description = "host storage path"
type = string
}
@@ -45,7 +45,7 @@ variable "current_version" {
type = string
}
variable "app_backup_folder" {
variable "backup_folder" {
description = "Backup source location"
type = string
}
@@ -142,13 +142,13 @@ resource "kubernetes_cron_job_v1" "backup_job" {
volume {
name = "backup-storage"
host_path {
path = "${var.host_storage_path}/${var.app_backup_folder}"
path = var.target_folder
}
}
volume {
name = "persistent-storage"
host_path {
path = "${var.host_storage_path}/${var.app_files_folder}"
path = var.source_folder
}
}
volume {
@@ -37,11 +37,6 @@ variable "cron_schedule" {
type = string
}
variable "host_storage_path" {
description = "Host path"
type = string
}
variable "access_key" {
description = "Access key"
sensitive = true
@@ -59,12 +54,12 @@ variable "app_name" {
type = string
}
variable "app_files_folder" {
variable "source_folder" {
description = "Name of host folder"
type = string
}
variable "app_backup_folder" {
variable "target_folder" {
description = "Backup source location"
type = string
}