Automate first boot with Configuration drive and cloud-init
Introduction
As part of the Guest setup feature, Abiquo supports Configuration drive feature in private cloud datacenters for automating first boot configuration. And in public cloud datacenters, Abiquo supports cloud-init.
What is Configuration drive
The Configuration drive feature enables administrators to automate the configuration of a VM at first boot by creating an ISO disk with user data files. Then Cloud-init or a similar system can configure the VM from the user data. The Configuration drive feature can be used on VMs with private network or no network connectivity, because the VM pulls its own configuration from the ISO and there is no need for an external process to connect to the VM to configure it.
Configuration drive in Abiquo
In order to use the Configuration drive feature, users must first obtain or create compatible templates, such as templates that will run cloud-init services or cloudbase-init services (for Windows). When creating a VM, the user can enter a configuration definition for cloud-init or other system on the Abiquo VM Bootstrap script tab. The user can additionally enter keys and/or values on the Variables tab, either new keys or keys defined in the VM template. This information is stored in the Abiquo VM metadata, and can also be managed using the Abiquo API.
Abiquo places the Bootstrap script content in a user_data file and the variables in a vm-variables.rc file. Abiquo also creates Configuration drive meta_data.json file. For example, Abiquo supplies the VM’s unique identifier to configure the default VM hostname. However, for example, the user can override the hostname in the Bootstrap script. Abiquo can also add the SSH public key, if the user has one. And if there is no DHCP service in the datacenter, Abiquo will inject the network configuration.
When the user deploys the VM, Abiquo copies and uploads the configuration data to the hypervisor and attaches an ISO disk with this data to the VM. The ISO disk will count towards the limit of a maximum of 4 IDE drives per VM. The ISO disk is not assigned to a datastore tier. At first boot, cloud-init configures the VM.
As part of this feature, the VM's Bootstrap script tab is now available in private cloud for Configuration drive use only. Configuration drive is hypervisor agnostic and support for the bootstrap script depends on the configuration of cloud-init or another system on the VM template.
Bootstrap with Configuration drive in private cloud
To automate configuration at first boot in private cloud, add a configuration definition for your VM. Abiquo will add the configuration definition to an ISO disk on your VM, making it available to configuration systems on first boot for use with cloud-init templates and similar. You can use this feature if you have the "Edit virtual appliance details" privilege.
Abiquo versions 3.10.5 and 4.0.2 introduce support for adding a fully qualified domain name (FQDN) using configuration drive and cloud-init. The user can edit the VM and enter the FQDN on the General tab. If Abiquo detects that first boot automation is available, it may automatically set the FQDN using the name attribute of the VM obtained from the Abiquo API, with the format ABQ-uuid and the domain of the VM's networks, or the localhost domain.
The VM templates determine the support for the bootstrap format and the VM configuration. Check your provider's documentation before working with this feature
VM support
If your platform supports the bootstrap feature:
- Abiquo creates an ISO disk on the VM, so your VM must have fewer than four IDE disks attached before you begin
- If there is bootstrap data, Abiquo creates an ISO disk
- Abiquo will check that there are fewer than 4 IDE drives before attaching the ISO because that is the maximum number you can attach to the VM
- The ISO disk has the label "config-2"
- Abiquo adds the following files to the folder "openstack/latest"
- user_data: Abiquo VM Bootstrap script
- vm-variables.rc: Abiquo VM variables that are in 'key'='value'
meta_data.json: Abiquo VirtualMachineIdentifier. The meta_data.json file is in the following format:
If DHCP is not used in your environment, the network configuration of the VM will be placed in network_data.json file
- You must obtain or create a template that runs cloud-init services or cloudbase-init services (for Windows), or a similar system. The template that you use will determine what the VM will do with the configuration data.
- VM access
- You do not need to allow any type of access to the VM because the VM can pull its own configuration from the Configuration drive.
References:
- metadata.json: https://docs.openstack.org/user-guide/cli-config-drive.html
- network_data.json: http://specs.openstack.org/openstack/nova-specs/specs/liberty/implemented/metadata-service-network-info.html#rest-api-impact
Add a bootstrap script for a VM
Edit the VM, and open the Bootstrap tab. Paste your configuration definition in the text box.
You can also add VM variables on the Variables tab and Abiquo will add them to the vm-variables.rc file. And Abiquo will automatically add metadata for the VM, but you can overwrite this in the Bootstrap data.
Copyright © 2006-2022, Abiquo Holdings SL. All rights reserved