Using cloud-init
to manage virtual machine settings¶
cloud-init
is a virtual machine initialization program commonly used in cloud platforms.
cloud-init
works like this: it reads the “User-data” (user-data) settings data and, if they are set in a format that cloud-init understands, then it can perform the actions described in the user data, ignoring the metadata service settings.
Thus, it is possible to automatically configure virtual machines for launch, for example, specify in user-data the host on which the machine will be launched, and also disable some functions, for example, block directories responsible for the ability to use certain device classes.
Since the cloud-init
procedure is only executed when virtual machines are initialized, it is difficult to change these settings later.
However, the problem is solved by moving the cloud-init
file to the tmpfs/
directory. In this case, the virtual machine settings will be read every time the machine is started.