Hi folks,
I'm pretty new to cloud-init and was playing around with it today. I struggle a bit with executing a custom command.
I have found this post https://forum.proxmox.com/threads/cloudinit-userdata-runcmd.53099/ and this blog post https://blog.dustinrue.com/2020/05/going-deeper-with-proxmox-cloud-init/ explaining pretty much the steps required to add
The question I have is, do I really have to put all the Proxmox defaults into a
If I have to pass the complete file, is it still possible to edit cloud-init options via the Proxmox GUI?
At the moment I'm not feeling comfortable to create snippets at all.
What I try to achieve is, to add a generic cloud image from Ubuntu and Debian as a VM template. I'm doing this like so and it is working perfectly fine so far.
Is it possible to add a runcmd via
I'm pretty new to cloud-init and was playing around with it today. I struggle a bit with executing a custom command.
I have found this post https://forum.proxmox.com/threads/cloudinit-userdata-runcmd.53099/ and this blog post https://blog.dustinrue.com/2020/05/going-deeper-with-proxmox-cloud-init/ explaining pretty much the steps required to add
runcmd
commands.The question I have is, do I really have to put all the Proxmox defaults into a
snippets/user-data.yml
file, or can I only add my runcmd part and Proxmox will merge both files together?If I have to pass the complete file, is it still possible to edit cloud-init options via the Proxmox GUI?
At the moment I'm not feeling comfortable to create snippets at all.
What I try to achieve is, to add a generic cloud image from Ubuntu and Debian as a VM template. I'm doing this like so and it is working perfectly fine so far.
Code:
wget https://cloud-images.ubuntu.com/focal/current/focal-server-cloudimg-amd64.img
qm create 7000 --name "ubuntu-2004-cloudinit-template" --cores 2 --sockets 1 --memory 2048 --net0 virtio,bridge=vmbr0 --agent 1 --ostype l26
qm importdisk 7000 focal-server-cloudimg-amd64.img local-zfs
qm set 7000 --scsihw virtio-scsi-pci --scsi0 local-zfs:vm-7000-disk-0,cache=writeback,discard=on
qm set 7000 --serial0 socket --vga serial0
qm set 7000 --ide2 local-zfs:cloudinit
qm set 7000 --boot c --bootdisk scsi0
qm set 7000 --ipconfig0 ip=dhcp
qm set 7000 --nameserver 192.168.0.1
qm set 7000 --searchdomain "home.lab"
qm set 7000 --ciuser root
qm set 7000 --sshkeys "/var/lib/homelab/ansible_id_rsa.pub"
Is it possible to add a runcmd via
qm set
somehow? I would need this to trigger an HTTP API to start Ansible which will install some packages and configurations onto the system.