parameterize ssh keys in create vm module [ci skip]
This commit is contained in:
parent
8da88f9f6d
commit
e0d8f7df3b
2 changed files with 10 additions and 8 deletions
4
main.tf
4
main.tf
|
|
@ -180,8 +180,8 @@ module "template-vm" {
|
||||||
# vm_name = "pxe-server"
|
# vm_name = "pxe-server"
|
||||||
# vm_disk_size = 50
|
# vm_disk_size = 50
|
||||||
# cisnippet_name = local.vm_cloud_init_snippet_name
|
# cisnippet_name = local.vm_cloud_init_snippet_name
|
||||||
|
# bridge = "vmbr0"
|
||||||
# # vm_mac_address = "00:50:56:87:4a:2d"
|
# vm_mac_address = "00:50:56:87:4a:2d"
|
||||||
# }
|
# }
|
||||||
|
|
||||||
# module "k8s_master" {
|
# module "k8s_master" {
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,11 @@ variable "vm_mac_address" {
|
||||||
default = null
|
default = null
|
||||||
}
|
}
|
||||||
variable "cisnippet_name" { type = string }
|
variable "cisnippet_name" { type = string }
|
||||||
|
variable "ssh_keys" {
|
||||||
|
type = string
|
||||||
|
default = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDHLhYDfyx237eJgOGVoJRECpUS95+7rEBS9vacsIxtx devvm"
|
||||||
|
}
|
||||||
|
variable "bridge" { type = string }
|
||||||
|
|
||||||
|
|
||||||
resource "proxmox_vm_qemu" "cloudinit-vm" {
|
resource "proxmox_vm_qemu" "cloudinit-vm" {
|
||||||
|
|
@ -36,28 +41,26 @@ resource "proxmox_vm_qemu" "cloudinit-vm" {
|
||||||
os_type = "cloud-init"
|
os_type = "cloud-init"
|
||||||
|
|
||||||
# Cloud-Init configuration
|
# Cloud-Init configuration
|
||||||
|
cicustom = "vendor=local:snippets/${var.cisnippet_name}"
|
||||||
ciupgrade = true
|
ciupgrade = true
|
||||||
nameserver = "1.1.1.1 8.8.8.8"
|
nameserver = "1.1.1.1 8.8.8.8"
|
||||||
ipconfig0 = "ip=dhcp,ip6=dhcp"
|
ipconfig0 = "ip=dhcp,ip6=dhcp"
|
||||||
skip_ipv6 = true
|
skip_ipv6 = true
|
||||||
ciuser = "root"
|
ciuser = "root"
|
||||||
sshkeys = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDHLhYDfyx237eJgOGVoJRECpUS95+7rEBS9vacsIxtx vbarzin@gmail.com"
|
sshkeys = var.ssh_keys
|
||||||
searchdomain = "viktorbarzin.lan"
|
searchdomain = "viktorbarzin.lan"
|
||||||
onboot = true # start on node boot
|
onboot = true # start on node boot
|
||||||
qemu_os = "l26"
|
qemu_os = "l26"
|
||||||
cicustom = "vendor=local:snippets/${var.cisnippet_name}"
|
|
||||||
|
|
||||||
cpu {
|
cpu {
|
||||||
cores = var.vm_cpus
|
cores = var.vm_cpus
|
||||||
type = "host" # emulate host cpu
|
type = "host" # emulate host cpu
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Most cloud-init images require a serial device for their display
|
# Most cloud-init images require a serial device for their display
|
||||||
serial {
|
serial {
|
||||||
id = 0
|
id = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
disks {
|
disks {
|
||||||
scsi {
|
scsi {
|
||||||
scsi0 {
|
scsi0 {
|
||||||
|
|
@ -78,10 +81,9 @@ resource "proxmox_vm_qemu" "cloudinit-vm" {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
network {
|
network {
|
||||||
id = 0
|
id = 0
|
||||||
bridge = "vmbr0"
|
bridge = var.bridge
|
||||||
model = "e1000"
|
model = "e1000"
|
||||||
macaddr = var.vm_mac_address
|
macaddr = var.vm_mac_address
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue