Skip to content

Commit

Permalink
feat: add pre_exec and post_exec scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
KoLiBer committed Dec 15, 2023
1 parent 11061b1 commit 63d0c3b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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
}

Expand All @@ -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
}

Expand Down
4 changes: 4 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 63d0c3b

Please sign in to comment.