Passing metadata and user data to cloud-init
In our examples, we are going to create a file that will essentially be an .iso
image and behave like a CD-ROM connected to the booting machine. Cloud-init knows how to handle a situation like this, and will mount the file, extract all the scripts, and run them in a predetermined order, as we already mentioned when we explained how the boot sequence works (check the Understanding cloud-init architecture section earlier in this chapter).
In essence, what we have to do to get the whole thing running is to create an image that will get connected to the cloud template, and that will provide all the data files to the cloud-init scripts inside the template. This is a three-step process:
- We have to create the files that hold the configuration information.
- We have to create an image that contains the file data in the right place.
- We need to associate the image with the template at boot time.
The most complicated part...