[SOLVED] understanding cloud-init provisioning

lethargos

Well-Known Member
Jun 10, 2017
145
6
58
75
I've been reading various resources on the internet related to cloud-init, including the proxmox documentation on this, but I'm still finding it difficult to understand exactly how it works and how you're supposed to provision it.

Basically, I would like to understand the relationship between the cloud-init configuration as a snippet (yaml) and the cloud-init drive that is supposed to mount some kind of iso.

If, for example, I install Ubuntu 20.04, then add the cloud-init drive and edit the configuration (network, user, ssh, whatever) in the GUI as is, it is simply ignored.
I was able to make it work with Debian 10, after manually installing cloud-init, so I'm not sure where the difference lies.

I'm looking forward to advice on how to provision Ubuntu 20.04 initiall only using the cloud-init drive and then integrating the snippet somehow and the difference between the two.

Thanks.
 
The `snippet` is just an alternative way to specify a config which is more flexible than setting the options via the GUI/API, but at the cost of no GUI support. It also supports anything cloud-init itself supports, as it is passed through 1:1. The GUI/API is limited to a small subset of useful options.

If you don't use a cloudimg, you have to manually install the cloud-init package. It is advised to configure it the way you want inside the guest (/etc/cloud/cloud.cfg), and then run `cloud-init clean` before shutting it down for creating the template.
This will make sure that on the next boot, when you have a cloud-init drive attached, it will actually read it and configure the guest accordingly.
 
Thanks for the reply. I don't think cloud-init clean is enough actually to reset cloud-init. It didn't work for me, at least. You also need to remove /etc/cloud/cloud.cfg.d/subiquity-disable-cloudinit-networking.cfg and add under /etc/cloud/cloud.cfg.d a file called for example 99-pve with the following content:
Code:
datasource_list: [ NoCloud ]
This is how it it eventually worked in my case.

(You can use "ICODE" between square brackets in order to do inline code highlighting :) )
 
Hello,

Another question related to this topic: can the cloud-init configuration in the snippet be loaded independently of the cloud-init drive?
I was reading the documentation for the proxmox provider of terraform (https://registry.terraform.io/providers/Telmate/proxmox/latest/docs/guides/cloud_init) and there it says:
Now, there is one other way to get the configuration data into the guest without using this magical CloudInit CD-ROM and that's by using cicustom.
Is this accurate? I can just set cicustom and disable the cloud-init drive?
 
No, it just takes the config from the snippets instead of generating it based on the VM Config.
The config is then still put in an ISO and attached as CD-ROM.
 
  • Like
Reactions: lethargos