Dagger
Search

pvectl

Runs pvectl (https://github.com/stuttgart-things/pvectl) from its
container image in programmatic mode (-o json) and returns the JSON it
prints. Typical use: after a Packer build, check the new template and
promote it (move to ul-pve11, FS9100 copy, repins).

Rules that carry over from pvectl:
- VM descriptions (notes) are never returned; in LabUL they hold
plaintext passwords.
- TLS is always verified: pass the cluster CA (caCert) or the pinned
SHA-256 of the API certificate (fingerprint). There is no insecure
switch.
- template-promote only shows the plan (--dry-run) unless apply is set.

Credentials are Dagger secrets: an API token (tokenId + tokenSecret,
preferred) or user + password.

Installation

dagger install github.com/stuttgart-things/dagger/pvectl@v0.140.0

Entrypoint

Return Type
Pvectl !
Arguments
NameTypeDefault ValueDescription
urlString !-Proxmox API URL, e.g. https://ul-pve01.labul.sva.de:8006/api2/json
tokenIdSecret -API token ID: user@realm!tokenname
tokenSecretSecret -API token secret
userSecret -User (user@realm), instead of a token
passwordSecret -Password, instead of a token
caCertSecret -Cluster CA (/etc/pve/pve-root-ca.pem), PEM
fingerprintString -SHA-256 of the API certificate (AB:CD:...), pinned for this run
imageString "ghcr.io/stuttgart-things/pvectl:v0.5.0"pvectl image
Example
dagger -m github.com/stuttgart-things/dagger/pvectl@8fdc5c0b160ea99e47953e668de0ada1291ef8f5 call \
 --url string
func (m *MyModule) Example(url string) *dagger.Pvectl  {
	return dag.
			Pvectl(url)
}
@function
def example(url: str, ) -> dagger.Pvectl:
	return (
		dag.pvectl(url)
	)
@func()
example(url: string, ): Pvectl {
	return dag
		.pvectl(url)
}

Types

Pvectl 🔗

Pvectl runs pvectl against one Proxmox VE cluster

config() 🔗

Config shows a VM or template config (without description) and its checks; fails with the JSON when a check fails

Return Type
String !
Arguments
NameTypeDefault ValueDescription
vmidInteger !-

VMID

Example
dagger -m github.com/stuttgart-things/dagger/pvectl@8fdc5c0b160ea99e47953e668de0ada1291ef8f5 call \
 --url string config --vmid integer
func (m *MyModule) Example(ctx context.Context, url string, vmid int) string  {
	return dag.
			Pvectl(url).
			Config(ctx, vmid)
}
@function
async def example(url: str, vmid: int) -> str:
	return await (
		dag.pvectl(url)
		.config(vmid)
	)
@func()
async example(url: string, vmid: number): Promise<string> {
	return dag
		.pvectl(url)
		.config(vmid)
}

tasks() 🔗

Tasks lists recent Proxmox tasks (JSON array)

Return Type
String !
Arguments
NameTypeDefault ValueDescription
nodeString -

only tasks of this node

vmidInteger -

only tasks of this VMID

errorsBoolean -

only failed tasks

sinceString -

only tasks started within this duration, e.g. 96h

Example
dagger -m github.com/stuttgart-things/dagger/pvectl@8fdc5c0b160ea99e47953e668de0ada1291ef8f5 call \
 --url string tasks
func (m *MyModule) Example(ctx context.Context, url string) string  {
	return dag.
			Pvectl(url).
			Tasks(ctx)
}
@function
async def example(url: str, ) -> str:
	return await (
		dag.pvectl(url)
		.tasks()
	)
@func()
async example(url: string, ): Promise<string> {
	return dag
		.pvectl(url)
		.tasks()
}

templatePromote() 🔗

TemplatePromote promotes a fresh Packer template: checks, migrate to the target node, FS9100 copy, repins. Without apply it only returns the plan (–dry-run) and changes nothing.

Return Type
String !
Arguments
NameTypeDefault ValueDescription
vmidInteger !-

template VMID

toString "ul-pve11"

migrate the template to this node

fsCopyBoolean true

make the full FS9100 copy for Telmate Terraform (–fs-copy=false: none)

allowOldBoolean -

promote even with warnings (a newer template exists, or the source is still pinned)

repoDirectory -

stuttgart-things checkout to read the current repin values from (read only)

applyBoolean -

carry out the plan (–yes). Default: –dry-run, nothing is written

Example
dagger -m github.com/stuttgart-things/dagger/pvectl@8fdc5c0b160ea99e47953e668de0ada1291ef8f5 call \
 --url string template-promote --vmid integer
func (m *MyModule) Example(ctx context.Context, url string, vmid int) string  {
	return dag.
			Pvectl(url).
			Templatepromote(ctx, vmid)
}
@function
async def example(url: str, vmid: int) -> str:
	return await (
		dag.pvectl(url)
		.templatepromote(vmid)
	)
@func()
async example(url: string, vmid: number): Promise<string> {
	return dag
		.pvectl(url)
		.templatePromote(vmid)
}

tls() 🔗

Tls shows the API certificate and how this run trusts it (no login)

Return Type
String !
Example
dagger -m github.com/stuttgart-things/dagger/pvectl@8fdc5c0b160ea99e47953e668de0ada1291ef8f5 call \
 --url string tls
func (m *MyModule) Example(ctx context.Context, url string) string  {
	return dag.
			Pvectl(url).
			Tls(ctx)
}
@function
async def example(url: str, ) -> str:
	return await (
		dag.pvectl(url)
		.tls()
	)
@func()
async example(url: string, ): Promise<string> {
	return dag
		.pvectl(url)
		.tls()
}

vms() 🔗

Vms lists VMs or templates by name substring or VMID (JSON array)

Return Type
String !
Arguments
NameTypeDefault ValueDescription
filterString -

name substring or VMID

templatesBoolean -

list templates instead of VMs

allBoolean -

list VMs and templates

Example
dagger -m github.com/stuttgart-things/dagger/pvectl@8fdc5c0b160ea99e47953e668de0ada1291ef8f5 call \
 --url string vms
func (m *MyModule) Example(ctx context.Context, url string) string  {
	return dag.
			Pvectl(url).
			Vms(ctx)
}
@function
async def example(url: str, ) -> str:
	return await (
		dag.pvectl(url)
		.vms()
	)
@func()
async example(url: string, ): Promise<string> {
	return dag
		.pvectl(url)
		.vms()
}