3
votes

Recently, I have been provisioning cloud servers using Cloud-init. I like it and it is sufficient for my usecase which is simple configuration management.

To run and test Cloud-init scripts, I always have to spin up a new cloud instance and wait for several minutes to check whether it went through or not. It hugely impacts my productivity.

So, what is the best way to run Cloud init locally (on a virtual machine)? Ansible or Chef script can be executed locally in an idempotent matter.

I tried installing cloud-init package and executing cloud-init command. Apparently, it looks for some metadata files created by the Cloud Provider. Is it possible to mock those files?

Thanks in advance.

1

1 Answers

0
votes

You can use the NoCloud datasource

Ref: https://cloudinit.readthedocs.io/en/latest/topics/datasources/nocloud.html#nocloud

And then you can provide the user-data and meta-data either via a separate drive with vfat or iso9660 filesystem. Or provide via kernel command or SMBIOS option.