Skip to content

Commit

Permalink
janky stage2 provisioner
Browse files Browse the repository at this point in the history
  • Loading branch information
james-otten committed May 6, 2024
1 parent 194d2c2 commit a1df39f
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
21 changes: 21 additions & 0 deletions infra/tf/stage2.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
metallb_addr="$1"

cd /opt/meshdb_mgmt/
cd meshdb
git checkout james/infra
cd infra/cluster

sleep 10

terraform init
terraform plan
terraform apply

sed -i -e "s/METALLB_ADDR_RANGE/${metallb_addr}/g" metallb_extra.yaml
terraform init
terraform plan
terraform apply -auto-approve

sleep 30

kubectl apply -f /opt/meshdb_mgmt/meshdb/infra/cluster/metallb_extra.yaml
25 changes: 25 additions & 0 deletions infra/tf/stage2config.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
resource "null_resource" "mgr_stage_two" {
connection {
type = "ssh"
user = "${var.meshdb_local_user}"
private_key = file("${path.module}/meshdb${var.meshdb_env_name}")
host = "${var.meshdb_ips[0]}"
}

provisioner "file" {
source = "${path.module}/stage2.sh"
destination = "/home/${var.meshdb_local_user}/stage2.sh"
}

provisioner "remote-exec" {
inline = [
format("sudo bash /home/%s/stage2.sh \"%s\"", var.meshdb_local_user, replace(var.meshdb_metallb_range, "/","\\/"))
]
}

depends_on = [
proxmox_vm_qemu.meshdbdevmgr,
proxmox_vm_qemu.meshdbnode,
null_resource.mgr_config_files
]
}

0 comments on commit a1df39f

Please sign in to comment.