Hi all,
I've been using Proxmox for a while now but only recently set out to automate some things.
Specifically, I'm interacting with the API to create VMs and I'm having some trouble with cloudinit.
What am I trying to achieve?
I'd like to have a VM template which has a bunch of stuff pre-installed e.g. rsync, git, nano, etc.
Using the API, I'd like to one-click fire up a new VM and give it a new randomly generated root password. It should also setup networking using an IP from my assigned IPV4 range.
Here's what I've done...
When I start the newly created VM, my new password doesn't work. In fact, the original password used on my Ubuntu template works.
It seems cloudinit hasn't worked
The second problem
Networking isn't working. In the "Hardware" tab in the "Network Device (net0)" entry I can see the value as set via the "net0" param above. Within the console if I do "ip addr show" this mac address is also shown. Furthermore, the IP address provided above is also shown against the "ens18" interface.
Furthermore, it looks like this isn't as fresh as I would have liked. The new VM has my command history from the template.
I suppose what I'm trying to achieve is a perfectly clean VM with a new root password and the network configured.
Any help would be greatly appreciated!
I've been using Proxmox for a while now but only recently set out to automate some things.
Specifically, I'm interacting with the API to create VMs and I'm having some trouble with cloudinit.
What am I trying to achieve?
I'd like to have a VM template which has a bunch of stuff pre-installed e.g. rsync, git, nano, etc.
Using the API, I'd like to one-click fire up a new VM and give it a new randomly generated root password. It should also setup networking using an IP from my assigned IPV4 range.
Here's what I've done...
- Created a new Ubuntu VM, updated it and installed a few things (git, rsync, nano, etc)
- Shut that down and converted it into a template (VM ID: 102)
- Via the API, I'm cloning the template and passing in a cloudinit username, password and some network config. Specifically, these are the params being sent to the API endpoint...
- ciuser => root
- cipassword => myrandompassword
- ipconfig0 => ip=XX.XX.XX.XX/32,gw=XX.XX.XX.XX,ip6=dhcp
- net0 => virtio=02:00:00:8a:53:b9,bridge=vmbr0,firewall=1
- Start up the VM
When I start the newly created VM, my new password doesn't work. In fact, the original password used on my Ubuntu template works.
It seems cloudinit hasn't worked
The second problem
Networking isn't working. In the "Hardware" tab in the "Network Device (net0)" entry I can see the value as set via the "net0" param above. Within the console if I do "ip addr show" this mac address is also shown. Furthermore, the IP address provided above is also shown against the "ens18" interface.
Furthermore, it looks like this isn't as fresh as I would have liked. The new VM has my command history from the template.
I suppose what I'm trying to achieve is a perfectly clean VM with a new root password and the network configured.
Any help would be greatly appreciated!