cloud init settings

This commit is contained in:
tolerryan
2025-02-03 00:41:22 -06:00
parent 9df2fa3d84
commit bd6dd2bba9

50
nas.tf
View File

@@ -1,6 +1,48 @@
# ---
# Create a new VM
resource "proxmox_cloud_init_disk" "ci" {
name = local.vm_name
pve_node = local.pve_node
storage = local.iso_storage_pool
meta_data = yamlencode({
instance_id = sha1(local.vm_name)
local-hostname = local.vm_name
})
user_data = <<-EOT
#cloud-config
users:
- root
ssh_authorized_keys:
- ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINFw70PrMsilcsqCrwW1I6PAt3anQbhmVg+t/HUfomug ryan@mxDesktop
EOT
network_config = yamlencode({
version = 1
config = [{
type = "physical"
name = "eth0"
subnets = [{
type = "static"
address = "192.168.0.50/24"
gateway = "192.168.0.1"
dns_nameservers = [
#"seconddns",
"192.168.0.24"
]
}]
}]
})
}
locals {
vm_name = "nas"
pve_node = "ryuk"
iso_storage_pool = "cephfs"
}
resource "proxmox_vm_qemu" "nas" {
# VM General Settings
@@ -76,13 +118,13 @@ resource "proxmox_vm_qemu" "nas" {
os_type = "cloud-init"
# (Optional) IP Address and Gateway
ipconfig0 = "ip=192.168.0.50/24,gw=192.168.0.1"
#ipconfig0 = "ip=192.168.0.50/24,gw=192.168.0.1"
# (Optional) Default User
# ciuser = "your-username"
# (Optional) Add your SSH KEY
sshkeys = <<EOF
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINFw70PrMsilcsqCrwW1I6PAt3anQbhmVg+t/HUfomug ryan@mxDesktop
EOF
#sshkeys = <<EOF
#ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINFw70PrMsilcsqCrwW1I6PAt3anQbhmVg+t/HUfomug ryan@mxDesktop
#EOF
}