pvectl
Runs pvectl (https://github.com/stuttgart-things/pvectl) from itscontainer 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.0Entrypoint
Return Type
Pvectl !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| url | String ! | - | Proxmox API URL, e.g. https://ul-pve01.labul.sva.de:8006/api2/json |
| tokenId | Secret | - | API token ID: user@realm!tokenname |
| tokenSecret | Secret | - | API token secret |
| user | Secret | - | User (user@realm), instead of a token |
| password | Secret | - | Password, instead of a token |
| caCert | Secret | - | Cluster CA (/etc/pve/pve-root-ca.pem), PEM |
| fingerprint | String | - | SHA-256 of the API certificate (AB:CD:...), pinned for this run |
| image | String | "ghcr.io/stuttgart-things/pvectl:v0.5.0" | pvectl image |
Example
dagger -m github.com/stuttgart-things/dagger/pvectl@8fdc5c0b160ea99e47953e668de0ada1291ef8f5 call \
--url stringfunc (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
| Name | Type | Default Value | Description |
|---|---|---|---|
| vmid | Integer ! | - | VMID |
Example
dagger -m github.com/stuttgart-things/dagger/pvectl@8fdc5c0b160ea99e47953e668de0ada1291ef8f5 call \
--url string config --vmid integerfunc (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
| Name | Type | Default Value | Description |
|---|---|---|---|
| node | String | - | only tasks of this node |
| vmid | Integer | - | only tasks of this VMID |
| errors | Boolean | - | only failed tasks |
| since | String | - | only tasks started within this duration, e.g. 96h |
Example
dagger -m github.com/stuttgart-things/dagger/pvectl@8fdc5c0b160ea99e47953e668de0ada1291ef8f5 call \
--url string tasksfunc (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
| Name | Type | Default Value | Description |
|---|---|---|---|
| vmid | Integer ! | - | template VMID |
| to | String | "ul-pve11" | migrate the template to this node |
| fsCopy | Boolean | true | make the full FS9100 copy for Telmate Terraform (–fs-copy=false: none) |
| allowOld | Boolean | - | promote even with warnings (a newer template exists, or the source is still pinned) |
| repo | Directory | - | stuttgart-things checkout to read the current repin values from (read only) |
| apply | Boolean | - | 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 integerfunc (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 tlsfunc (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
| Name | Type | Default Value | Description |
|---|---|---|---|
| filter | String | - | name substring or VMID |
| templates | Boolean | - | list templates instead of VMs |
| all | Boolean | - | list VMs and templates |
Example
dagger -m github.com/stuttgart-things/dagger/pvectl@8fdc5c0b160ea99e47953e668de0ada1291ef8f5 call \
--url string vmsfunc (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()
}