Ready-made operating system images that support cloud-init technology are auto-configured using the Cloud-init software.
In addition to standard actions such as network configuration, disk setup, and SSH keys, it allows for initial system configuration using metadata passed to the virtual machine through the metadata API, specifically the user-data
field.
The user-data
field can be set in three ways:
The configuration data passed to cloud-init is in YAML file format, starting with the line #cloud-config
. This is followed by directives specifying actions to be performed by cloud-init. The full list of directives can be found on the project page.
#cloud-config
package_upgrade: true
#cloud-config
hostname: mynewhostname123
fqdn: mynewhostname123.e24cloud.com
manage_etc_hosts: true
#cloud-config
package_upgrade: true
packages:
- rng-tools
write_files:
- content: |
HRNGDEVICE=/dev/hwrng
path: /etc/default/rng-tools
permissions: '0644'