The VM bootstrap script functionality varies between public cloud and private cloud. In private cloud, the bootstrap script can be used to add a configuration for cloud init and configuration drive, and you will need templates that support cloud-init services or cloudbase-init services or similar. In public cloud, you can add a bash script or other UNIX bootstrap script.
Bootstrap with Configuration drive in private cloud
To automate configuration at first boot in private cloud, add a configuration definition for your virtual machine. Abiquo will add the configuration definition to an ISO disk on your virtual machine, 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.
The virtual machine templates determine the support for the bootstrap format and the virtual machine configuration. Check your provider's documentation before working with this feature
If your platform supports the bootstrap feature:
- Abiquo creates an ISO disk on the VM, so your virtual machine 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 virtual machine Bootstrap script
- vm-variables.rc: Abiquo virtual machine 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 virtual machine will do with the configuration data.
- VM access
- You do not need to allow any type of access to the VM because the virtual machine can pull its own configuration from the Configuration drive.
- 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 virtual machine
Edit the virtual machine, 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 virtual machine, but you can overwrite this in the Bootstrap data.
Bootstrap scripts in public cloud
In Abiquo you can insert UNIX bootstrap scripts to execute on first boot of your UNIX virtual machines in public cloud. You can use this feature if you have the "Edit virtual appliance details" privilege. The bootstrap script feature is available in all public cloud providers supported by Abiquo.
Bootstrap scripts can be used on all UNIX VMs
Windows virtual machines are not yet supported
You must open port 22 on the virtual machine. In the cloud providers that support Firewalls (such as AWS, HP Cloud and Google Compute Engine), you can use the Abiquo firewalls feature to allow access.
Abiquo will connect to the virtual machine via SSH and upload the bootstrap script before running it. If you have a public SSH key configured in Abiquo, it will also be installed on the virtual machine to allow easy access to it.
Depending on the features supported by the cloud provider, Abiquo might create a key pair to be used to access the virtual machine, or might use the default (well known) credentials for the image.
The only requirement is that the virtual machines that are being configured have a public IP address (or a reachable IP address) and have a running SSH server and the port 22 accessible. Abiquo will use an SSH connection to the virtual machine to run the bootstrap script on it.
Add a bootstrap script for a virtual machine
Edit the virtual machine, and open the Bootstrap script tab. Paste your script in the text box.
Do not use any headers, such as #!/bin/sh, because your script will be included in an Abiquo wrapper bash script
With this feature you can use your own scripts or tools such as Ansible to configure your virtual infrastructure. See also http://www.abiquo.com/2014/05/14/abiquo-dynamic-inventory-plugin-for-ansible/
Abiquo will wrap the user's bootstrap script in another bash script. This is done to provide a way to store the output and the errors that the script might generate, so users can troubleshoot it if something does not work as expected. Therefore you should not include script headers because they are already included in the wrapper script. Abiquo names the wrapper script "abiquo-bootstrap". Abiquo will upload the script to the virtual machine and leave a symbolic link to the script location in the user's home directory.
Check script status and output
From your home directory, use the following commands to see the output and status of the script:
- ./abiquo-bootstrap status - Shows the PID of the bootstrap process (or nothing if it has finished).
- ./abiquo-bootstrap stdout - Shows the full standard output for the bootstrap process.
- ./abiquo-bootstrap stderr - Shows the full error output for the bootstrap process.
- ./abiquo-bootstrap tail - Shows the last lines of the standard output for the bootstrap process.
- ./abiquo-bootstrap tailerr - Shows the last lines of the error output for the bootstrap process.
- ./abiquo-bootstrap exitstatus - Shows the exit code of the bootstrap process (0 usually means success).