From 8a443a7e21ae4c0f0d93a64fa02a14fd8a56289d Mon Sep 17 00:00:00 2001 From: Calle Pettersson Date: Wed, 10 Jul 2019 22:04:10 +0200 Subject: [PATCH] Allow running the template VM in a Proxmox resource pool --- builder/proxmox/config.go | 1 + builder/proxmox/step_start_vm.go | 3 +++ website/source/docs/builders/proxmox.html.md | 2 ++ 3 files changed, 6 insertions(+) diff --git a/builder/proxmox/config.go b/builder/proxmox/config.go index e84d81d2c..6889c8c07 100644 --- a/builder/proxmox/config.go +++ b/builder/proxmox/config.go @@ -32,6 +32,7 @@ type Config struct { Username string `mapstructure:"username"` Password string `mapstructure:"password"` Node string `mapstructure:"node"` + Pool string `mapstructure:"pool"` VMName string `mapstructure:"vm_name"` VMID int `mapstructure:"vm_id"` diff --git a/builder/proxmox/step_start_vm.go b/builder/proxmox/step_start_vm.go index 82358efb2..76663b33f 100644 --- a/builder/proxmox/step_start_vm.go +++ b/builder/proxmox/step_start_vm.go @@ -62,6 +62,9 @@ func (s *stepStartVM) Run(ctx context.Context, state multistep.StateBag) multist } vmRef := proxmox.NewVmRef(c.VMID) vmRef.SetNode(c.Node) + if c.Pool != "" { + vmRef.SetPool(c.Pool) + } err := config.CreateVm(vmRef, client) if err != nil { diff --git a/website/source/docs/builders/proxmox.html.md b/website/source/docs/builders/proxmox.html.md index e97279a73..ca7c99ea3 100644 --- a/website/source/docs/builders/proxmox.html.md +++ b/website/source/docs/builders/proxmox.html.md @@ -55,6 +55,8 @@ builder. ### Optional: - `insecure_skip_tls_verify` (bool) - Skip validating the certificate. +- `pool` (string) - Name of resource pool to create virtual machine in. + - `vm_name` (string) - Name of the virtual machine during creation. If not given, a random uuid will be used.