I have cephfs:snippets set up with cloud-init files. This is for creating Ubuntu 20.04 VMs. Here's an example:
Then I use it like this:
This works the first time. The VM boots and it gets a network config. However it doesn't persist across reboots... I have to add this back. Why is this? I thought cloud-init runs on first boot and afterwards it's good to go. Why would I have to maintain the existence of this network config file - why wouldn't this be ingested into the VM and stay there? I have the guest agent installed and it reports no network configuration...
Edit: forgot --cicustom in the second line of the qm commands.
Bash:
# cat /mnt/pve/cephfs/snippets/net107.yaml
version: 1
config:
- type: physical
name: eth0
mac_address: '36:9d:01:aa:42:d8'
subnets:
- type: static
address: '192.168.122.107'
netmask: '255.255.255.0'
gateway: '192.168.122.1'
- type: nameserver
address:
- '192.168.122.104'
search:
- 'example.com'
Then I use it like this:
Bash:
# qm create 107 --net0 virtio,bridge=vmbr0 --sockets 1 --cores 2 --memory 2048 --name testvm
# qm set 107 --cicustom "network=cephfs:snippets/net107.yaml"
# qm start 107
# qm set 107 --cicustom ""
This works the first time. The VM boots and it gets a network config. However it doesn't persist across reboots... I have to add this back. Why is this? I thought cloud-init runs on first boot and afterwards it's good to go. Why would I have to maintain the existence of this network config file - why wouldn't this be ingested into the VM and stay there? I have the guest agent installed and it reports no network configuration...
Edit: forgot --cicustom in the second line of the qm commands.
Last edited: