In the latest package of the Versa Director, the cloud-init custom script injection works with ConfigDrive selected in the qcow2 image. To see the change, check :/etc/cloud/cloud.cfg.d/91_versa.cfg file for datasource_list:[ConfigDrive,OVF].
NOTE: The other file format #cloud-config does not work now.
Testing the Script (For Internal Use Only)
Follow these steps to test the script:
- Access the latest qcow2.
- Create an image in the OpenStack.
- Select the Custom Script tab to create an instance. Enter this script:
#!/bin/bash echo “Hello Versa” > /tmp/hello.txt
- Set ConfiDrive to true in the Custom Script tab.
- Check for Hello Versa in /tmp/hello.txt after creating the instance.
- Additionally, check the cloud init directory (/var/lib/cloud/instance) for information related to the guest injection files like; user-data.txt, and cloud-config.txt.
Configuring Ethernet Interfaces
Refer to this script to create an ethernet interface in /etc/network/interfaces.d.
#!/bin/bash readonly ENI=/etc/network/interfaces cat <<-EOF' > /etc/network/interfaces.d/eth0.cfg auto eth0 iface eth0 inet static address <static-address> netmask <subnet-mask> gateway <gateway-address EOF if ! grep -q source $ENI; then echo "source /etc/network/interfaces.d/*.cfg" >> $ENI fi
NOTE: Run this script on system startup (similar to the steps explained in "Testing the Script" section).
This script ensures that the ethernet interface is assigned a static IP address when the VM starts.