Fix some networking issues and setup a second nomad host
This commit is contained in:
@@ -13,21 +13,38 @@ terraform {
|
||||
|
||||
provider "template" {}
|
||||
|
||||
variable "ssh_password" {
|
||||
description = "Password for SSH connection"
|
||||
type = string
|
||||
variable "nodes" {
|
||||
description = "Map of nodes with host, password, and bind interface"
|
||||
type = map(object({
|
||||
host = string
|
||||
password = string
|
||||
bind_interface = string
|
||||
bootstrap = optional(bool, false) # Optional field for bootstrap nodes
|
||||
}))
|
||||
}
|
||||
|
||||
locals {
|
||||
config_files = { for k, v in var.nodes :
|
||||
k => templatefile("${path.module}/configuration.nix", {
|
||||
hostname = v.host
|
||||
bind_interface = v.bind_interface
|
||||
bootstrap = v.bootstrap
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
resource "null_resource" "deploy_nixos" {
|
||||
for_each = var.nodes
|
||||
|
||||
connection {
|
||||
type = "ssh"
|
||||
host = "jaglan-beta-m01.othrayte.one"
|
||||
host = "${each.value.host}.lan"
|
||||
user = "root"
|
||||
password = var.ssh_password
|
||||
password = each.value.password
|
||||
}
|
||||
|
||||
provisioner "file" {
|
||||
source = "configuration.nix"
|
||||
content = local.config_files[each.key]
|
||||
destination = "/tmp/configuration.nix"
|
||||
}
|
||||
|
||||
@@ -39,6 +56,6 @@ resource "null_resource" "deploy_nixos" {
|
||||
}
|
||||
|
||||
triggers = {
|
||||
configuration_content = file("configuration.nix")
|
||||
configuration_content = local.config_files[each.key]
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user