Many things
Some checks failed
/ non-lab (push) Waiting to run
/ authentik (push) Has been cancelled

This commit is contained in:
Chris Cowley 2025-04-17 15:15:03 +02:00
parent 05d4287d05
commit 4ecb167ff6
5 changed files with 52 additions and 67 deletions

View file

@ -6,37 +6,6 @@ locals {
}
# module "virtnode" {
# source = "../terraform-modules/coreos-agent"
#
# name = "virtnode"
# pool = "default"
# base_image = "http://matchbox.lab.cowley.tech:8080/assets/fedora-coreos/fedora-coreos-39.20231101.3.0-qemu.x86_64.qcow2"
# memory = 2048
# vcpu = 1
# disk_size = 30
#
# bridge = "br6"
# ignition = data.ignition_config.worker.rendered
# }
#resource "matchbox_profile" "worker" {
# name = "worker"
# kernel = local.kernel
# initrd = [
# "--name main ${local.initrd}"
# ]
# args = [
# "ip=dhcp",
# "initrd=main",
# "coreos.live.rootfs_url=${local.rootfs}",
# "coreos.inst.install_dev=/dev/vda",
# "coreos.inst.ignition_url=${var.matchbox_http_endpoint}/ignition?uuid=$${uuid}&mac=$${mac:hexhyp}",
# "console=tty0",
# "console=ttyS0",
# ]
# raw_ignition = data.ignition_config.worker.rendered
#}
resource "matchbox_profile" "nuc" {
name = "nuc"
@ -67,25 +36,6 @@ resource "matchbox_group" "nuc" {
}
}
#resource "matchbox_group" "slowworker" {
# for_each = var.slowworkers
#
# name = each.key
# profile = matchbox_profile.worker.name
# selector = {
# mac = each.value
# }
#
#}
#resource "matchbox_group" "worker" {
# name = "worker"
# profile = matchbox_profile.worker.name
# selector = {
# mac = "52:54:00:c3:51:e8"
# }
#
#}
data "ignition_user" "core" {
name = "core"
@ -95,23 +45,7 @@ data "ignition_user" "core" {
var.ssh_authorized_key
]
}
#
#data "ignition_config" "worker" {
# users = [
# data.ignition_user.core.rendered
# ]
# systemd = [
# data.ignition_systemd_unit.qemu_ga.rendered,
# data.ignition_systemd_unit.k3s_install.rendered,
# data.ignition_systemd_unit.worker-images-clean-service.rendered,
# data.ignition_systemd_unit.worker-images-clean-timer.rendered
# ]
# files = [
# data.ignition_file.worker-options.rendered,
# data.ignition_file.k3s_agent_install_script.rendered,
# data.ignition_file.worker-images-clean.rendered
# ]
#}
data "ignition_config" "nuc" {
users = [
data.ignition_user.core.rendered

View file

@ -30,3 +30,13 @@ resource "opnsense_unbound_host_override" "physical_lab" {
domain = "lab.cowley.tech"
server = each.value.address
}
resource "opnsense_unbound_host_override" "iot_devices" {
for_each = { for i, v in var.iot_devices : i => v }
enabled = true
description = each.value.description
hostname = each.value.name
domain = "lab.cowley.tech"
server = each.value.address
}

View file

@ -29,3 +29,11 @@ resource "opnsense_kea_reservation" "physical_lab" {
mac_address = each.value.mac
description = "Static IP for ${each.value.name}"
}
resource "opnsense_kea_reservation" "iot_devices" {
for_each = { for i, v in var.iot_devices : i => v }
subnet_id = opnsense_kea_subnet.subnets["iot"].id
ip_address = each.value.address
mac_address = each.value.mac
description = "Static IP for ${each.value.description}"
}

View file

@ -19,6 +19,16 @@ physical_lab = [
address = "192.168.6.61"
mac = "c0:3f:d5:66:ba:79"
},
{
name = "hc401"
address = "192.168.6.46"
mac = "00:1e:06:49:24:45"
},
{
name = "nut01"
address = "192.168.6.47"
mac = "b8:27:eb:4a:7e:04"
},
]
physical_home = [
{
@ -71,3 +81,18 @@ dhcp_subnets = {
home = "192.168.5.0/24"
lab = "192.168.6.0/24"
}
iot_devices = [
{
name = "garage-water-heater"
address = "192.168.3.3"
mac = "ac:0b:fb:da:42:8e"
description = "garage-water-heater"
},
{
name = "shelly1minig3-cc8da25df93c"
address = "192.168.3.4"
mac = "cc:8d:a2:5d:f9:3c"
description = "gate-relay"
},
]

View file

@ -19,6 +19,14 @@ variable "esphome_boards" {
mac = string
}))
}
variable "iot_devices" {
type = list(object({
name = string
address = string
mac = string
description = string
}))
}
variable "dhcp_subnets" {
type = map(string)
}