Skip to content

Commit

Permalink
netboot vm for saces (#3)
Browse files Browse the repository at this point in the history
Co-authored-by: hrmny <[email protected]>
  • Loading branch information
ij0n and ForsakenHarmony authored Jul 4, 2023
1 parent a5b6bb8 commit 46f61b2
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 2 deletions.
3 changes: 3 additions & 0 deletions locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ locals {
hrmny = {
ssh_key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEDtuIourWzbibkXqsJYk8IHxl4SIvxmnttrlUALu8XS [email protected]"
}
saces = {
ssh_key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIL5JruwHRLLVW1LDcoUymftOgqt6I2khSvvSnNLk7XZ4 [email protected]"
}
}

node = "nerdserv"
Expand Down
2 changes: 1 addition & 1 deletion modules/vm/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ resource "proxmox_virtual_environment_vm" "vm" {
datastore_id = var.disk.storage

user_account {
keys = clone.value
keys = initialization.value
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion modules/vm/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ variable "clone" {
}

variable "ssh_keys" {
type = string
type = list(string)
default = null
description = "clone the vm with the given ID"
}
Expand Down
27 changes: 27 additions & 0 deletions proxmox/netboot.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
module "netboot_vm" {
source = "../modules/vm"

name = "netboot"

node = var.node
pool = var.pool

clone = data.proxmox_virtual_environment_vm.debian_cloud_vm_template.vm_id

cores = 1
memory = 2048

disk = {
// gigabytes
size = 48
storage = var.storage.disk
}

network = {
bridge = var.network.bridge
}

ssh_keys = [
var.users["saces"].ssh_key
]
}
5 changes: 5 additions & 0 deletions proxmox/templates.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,8 @@ resource "proxmox_virtual_environment_file" "alpine_cloud_template" {
file_name = "alpine-3.18-cloud-amd64_20230625.tar.xz"
}
}

data "proxmox_virtual_environment_vm" "debian_cloud_vm_template" {
node_name = var.node
vm_id = 9000
}

0 comments on commit 46f61b2

Please sign in to comment.