From 63d0c3b9ed85690b784fcb7b980d61f580b2c8c0 Mon Sep 17 00:00:00 2001 From: KoLiBer Date: Fri, 15 Dec 2023 14:54:01 +0330 Subject: [PATCH] feat: add pre_exec and post_exec scripts --- cluster.tf | 6 ++++++ variables.tf | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/cluster.tf b/cluster.tf index 3355026..56762e5 100644 --- a/cluster.tf +++ b/cluster.tf @@ -48,7 +48,9 @@ module "leader" { cat <<-EOFX | tee /etc/rancher/${var.type}/config.yaml > /dev/null ${each.value.configs} EOFX + ${each.value.pre_exec} systemctl restart ${var.type}-server.service + ${each.value.post_exec} EOF } @@ -78,7 +80,9 @@ module "servers" { cat <<-EOFX | tee /etc/rancher/${var.type}/config.yaml > /dev/null ${each.value.configs} EOFX + ${each.value.pre_exec} systemctl restart ${var.type}-server.service + ${each.value.post_exec} EOF } @@ -104,7 +108,9 @@ module "agents" { cat <<-EOFX | tee /etc/rancher/${var.type}/config.yaml > /dev/null ${each.value.configs} EOFX + ${each.value.pre_exec} systemctl restart ${var.type}-server.service + ${each.value.post_exec} EOF } diff --git a/variables.tf b/variables.tf index 0fa0413..475d24c 100644 --- a/variables.tf +++ b/variables.tf @@ -71,6 +71,8 @@ variable "servers" { version = optional(string) registries = optional(any, {}) configs = optional(any, {}) + pre_exec = optional(string, "") + post_exec = optional(string, "") })) default = {} sensitive = false @@ -84,6 +86,8 @@ variable "agents" { version = optional(string) registries = optional(any, {}) configs = optional(any, {}) + pre_exec = optional(string, "") + post_exec = optional(string, "") })) default = {} sensitive = false