No description
Find a file
2020-11-01 20:09:16 +01:00
vendor initial commit 2020-06-01 12:18:20 +02:00
.gitignore fixed pool search 2020-06-04 22:40:38 +02:00
client.go added config 2020-10-31 21:54:59 +01:00
go.mod initial commit 2020-06-01 12:18:20 +02:00
go.sum initial commit 2020-06-01 12:18:20 +02:00
helper.go added clout init image docs 2020-11-01 20:09:16 +01:00
ipconfig.go added pointer receiver 2020-06-01 16:37:50 +02:00
LICENSE initial commit 2020-06-01 12:18:20 +02:00
network.go added pointer receiver 2020-06-01 16:37:50 +02:00
node.go added server ref 2020-10-25 21:29:19 +01:00
pool.go added server ref 2020-10-25 21:29:19 +01:00
README.md added clout init image docs 2020-11-01 20:09:16 +01:00
scheme.go added config 2020-10-31 21:54:59 +01:00
server.go added clout init image docs 2020-11-01 20:09:16 +01:00
serverstatus.go initial commit 2020-06-01 12:18:20 +02:00
snippet.diff added snippet upload 2020-10-25 11:58:48 +01:00
snippet.go added clout init image docs 2020-11-01 20:09:16 +01:00
task.go added snippet upload 2020-10-25 11:58:48 +01:00
userdata.go added snippet upload 2020-10-25 11:58:48 +01:00

pve-go

PVE-Go is a go library for the Proxmox VE API.

The design is based on the Hetzner Clound API implementation: https://github.com/hetznercloud/hcloud-go

Cloud-Init Image

How to prepare a cloud-init image.

Download the latest version of the base image to one of your proxmox nodes:

curl -sSL https://cloud-images.ubuntu.com/bionic/current/bionic-server-cloudimg-amd64.img >/tmp/bionic-server-cloudimg-amd64.img

Create a cloud-init config to bootstrap the template:

cat <<'EOF'> /var/lib/vz/snippets/9000_bootstrap
#cloud-config
package_update: true
package_upgrade: true
ntp:
  enabled: true
  servers: ["pool.ntp.org"]
ssh_deletekeys: true
ssh_genkeytypes: ["ed25519", "rsa"]
runcmd:
- "apt-get -y clean"
- "apt-get -y autoremove --purge"
- "bash -c 'rm /home/ubuntu/.ssh/authorized_keys; exit 0'"
- "bash -c 'find /var/log -type f | while read f; do echo -ne >$f; done; exit 0'"
- "bash -c 'rm -rf /var/lib/cloud/*; exit 0'"
power_state:
  mode: poweroff
EOF

Create the template VM:

qm destroy 9000
qm create 9000 --memory 2048 --net0 virtio,bridge=vmbr0
qm importdisk 9000 /tmp/bionic-server-cloudimg-amd64.img local
qm set 9000 --scsihw virtio-scsi-pci --scsi0 local:9000/vm-9000-disk-0.raw
qm set 9000 --ide0 local:cloudinit
qm set 9000 --boot c --bootdisk scsi0
qm set 9000 --serial0 socket --vga serial0
qm set 9000 --cicustom "user=local:snippets/9000_bootstrap"
qm set 9000 --ipconfig0 ip=dhcp,ip6=dhcp

qm start 9000
sleep 10;while :; do qm status 9000|grep -q stopped && break; done
qm set 9000 --cicustom ""
qm set 9000 --ipconfig0 ""
qm template 9000