feat: use static ips

This commit is contained in:
Tine 2024-11-08 22:11:27 +01:00
parent 5a116ddf9c
commit e189401d95
Signed by: mentos1386
SSH key fingerprint: SHA256:MNtTsLbihYaWF8j1fkOHfkKNlnN1JQfxEU/rBU8nCGw
3 changed files with 26 additions and 26 deletions

View file

@ -3,10 +3,8 @@ locals {
nodes = { nodes = {
for k, v in var.nodes : k => merge(v, { for k, v in var.nodes : k => merge(v, {
id = 800 + index(keys(var.nodes), k) id = 800 + index(keys(var.nodes), k)
hash = sha1(v.host) domain = local.domain
mac_address = "AA:BB:07:00:${format("%v:%v", substr(sha1(v.host), 0, 2), substr(sha1(v.host), 2, 2))}"
domain = local.domain
meta = { meta = {
name = v.host name = v.host
domain = local.domain domain = local.domain
@ -105,8 +103,7 @@ Repo: https://code.tjo.space/tjo-cloud/ingress
} }
network_device { network_device {
bridge = "vmbr1" bridge = "vmbr1"
mac_address = each.value.mac_address
} }
scsi_hardware = "virtio-scsi-single" scsi_hardware = "virtio-scsi-single"
@ -127,10 +124,12 @@ Repo: https://code.tjo.space/tjo-cloud/ingress
ip_config { ip_config {
ipv4 { ipv4 {
address = "dhcp" address = each.value.ipv4_address
gateway = each.value.ipv4_gateway
} }
ipv6 { ipv6 {
address = "dhcp" address = each.value.ipv6_address
gateway = each.value.ipv6_gateway
} }
} }
} }

View file

@ -3,16 +3,31 @@ nodes = {
host = "batuu" host = "batuu"
iso_storage = "local" iso_storage = "local"
boot_storage = "local-nvme" boot_storage = "local-nvme"
ipv4_address = "10.0.16.10/20"
ipv4_gateway = "10.0.16.1"
ipv6_address = "fd74:6a6f:0:1010::1/64"
ipv6_gateway = "fd74:6a6f:0:1000::1"
} }
jakku = { jakku = {
host = "jakku" host = "jakku"
iso_storage = "local" iso_storage = "local"
boot_storage = "local-nvme" boot_storage = "local-nvme"
ipv4_address = "10.0.32.10/20"
ipv4_gateway = "10.0.32.1"
ipv6_address = "fd74:6a6f:0:2010::1/64"
ipv6_gateway = "fd74:6a6f:0:2000::1"
} }
nevaroo = { nevaroo = {
host = "nevaroo" host = "nevaroo"
iso_storage = "local" iso_storage = "local"
boot_storage = "local" boot_storage = "local"
ipv4_address = "10.0.48.10/20"
ipv4_gateway = "10.0.48.1"
ipv6_address = "fd74:6a6f:0:3010::1/64"
ipv6_gateway = "fd74:6a6f:0:3000::1"
} }
} }

View file

@ -2,15 +2,11 @@ variable "nodes" {
type = map(object({ type = map(object({
host = string host = string
internal = optional(object({ ipv4_address = string
ipv4 = string ipv4_gateway = string
ipv6 = string
}))
public = optional(object({
ipv4 = string
ipv6 = string
}))
ipv6_address = string
ipv6_gateway = string
cores = optional(number, 1) cores = optional(number, 1)
memory = optional(number, 512) memory = optional(number, 512)
@ -26,21 +22,11 @@ variable "ssh_keys" {
type = list(string) type = list(string)
} }
variable "digitalocean_token" {
type = string
sensitive = true
}
variable "proxmox_token" { variable "proxmox_token" {
type = string type = string
sensitive = true sensitive = true
} }
variable "tailscale_apikey" {
type = string
sensitive = true
}
variable "authentik_token" { variable "authentik_token" {
type = string type = string
sensitive = true sensitive = true