Aller au contenu

Cloud-init

Cloud-init is a cross-platform cloud instance initialization tool that automates the configuration of cloud instances during their initial boot. It is supported by all major public cloud providers, provisioning systems for private cloud infrastructure, and bare-metal installations.

Cloud-init allows users to customize their cloud instances by providing a configuration file that specifies the desired settings. This file can be used to configure a variety of tasks, including:

  • Installing packages
  • Configuring users and security
  • Writing files
  • Running scripts

Create the cloud-init-data

The cloud-init Data is used when a VM is booting from a cloud image. It contains VM parameters, like the username and password, network configuration or other settings made at startup.

In this example, we create a .ISO file used as Boot CD and having the user and hostname defined.

echo -e "#cloud-config\npassword: ubuntu\nchpasswd: { expire: False }\nssh_pwauth: True" > user-data.yaml
echo -e "instance-id: ubuntu\nlocal-hostname: ubuntu" > meta-data.yaml
mkisofs -output "ubuntu-cloud-init-data.iso" -volid cidata -joliet -rock {user-data,meta-data}

References


Dernière mise à jour: 24 November 2023