CycleCloud supports cloud-init as a way of configuring a virtual machine (VM) on first boot before any other CycleCloud specific configuration occurs on the VM. Using cloud-init is an effective way to configure aspects of a VM (such as networking, yum/apt mirrors, and more) prior to installing any software managed by CycleCloud (HPC schedulers).
The following example shows how to specify a bash script to run on boot by using the CloudInit
attribute in a cluster template:
[node scheduler]
CloudInit = '''#!/bin/bash
echo "cloud-init works" > /tmp/cloud-init.txt
'''
Note
Use triple quoted strings in a cluster template to specify a multiline string, such as a bash or YAML script.
Warning
Not all OS images in Azure support cloud-init. For more information about which images support cloud-init and the timeline for broader support, see cloud-init support for virtual machines in Azure.
Set cloud-init using the UI
The CycleCloud UI supports cloud-init editing. When you create or edit any cluster, you can use the Cloud-Init tab to edit the cloud-init script for each node in your cluster. The editor in the CycleCloud UI accepts any text input. It provides syntax highlighting for Python, shell scripts, or YAML.
Cloud-init ordering and error handling
For CycleCloud nodes with CloudInit
specified, CycleCloud provisions the VM and waits until cloud-init runs to completion before it starts any other configuration. If you specify CloudInit
on the node but CycleCloud doesn't detect cloud-init support for the OS, the node goes into an error state and relays the reason to CycleCloud. If the CloudInit
script fails to execute (for example, due to a scripting error or syntax error), the node goes into an error state and relays the error reported by cloud-init to CycleCloud.
Once cloud-init runs to completion with no errors, CycleCloud continues to configure the VM as usual.
Important
CycleCloud doesn't automatically merge cloud-init scripts. If you specify a cloud-init script in [node defaults]
and have a node that inherits from those defaults, the cloud-init script in [node defaults]
gets overwritten. To share code, we suggest merging scripts manually. Alternatively, you can use an include file user-data format to include a list of URLs for cloud-init to process.