How to configure "cloud-init"


#1

Hi good folks… In the downstream version, support for RHEV “cloud-init” was added recently. Unfortunately, there doesn’t seem to be any documentation for it… It was tracked under BZ#1052353. Has anyone done this before?

thanks,

Jon


#2

Hi Jon,

Documentation for this feature should be available soon. In the meantime I hope the following is helpful.

The cloud-init customization templates can be added/edited in the Infrastructure -> PXE area with the other customization templates.

Cloud-init templates are available during RHEV provisioning when the Provision Type field on the “Catalog” tab is set to “Native Clone”. For Cloud provisioning they are always available. The cloud-init templates appear on the “Customize” tab under the “Customize Template” section in the provision dialog.


#3

Jon,
Here is an example for one that i did a few months back:

#cloud-config

CloudForms - Cloud-Init Script for Apache Installation

Kevin Morey, RHCE

Redhat Inc.

MiqProvisionAmazon_Web.yaml

For troubleshooting check: /var/lib/cloud/instance/user-data.txt & /var/log/boot.log

<%

Set Global Variables

root_password = evm[:root_password]
role = evm[:ws_values][:role] || evm[:role] rescue 'Web’
instance_name = evm[:vm_target_name]
%>

bootcmd:

Turn off SELinux

  • setenforce 0

runcmd:

Setup motd and root authorized keys

  • echo Welcome to Red Hat CloudForms <%=role%> Instance <%=instance_name%> > /etc/motd

Turn off firewall

  • echo “CloudForms - Turning off firewall”

  • chkconfig iptables off

  • service iptables stop

    Install Apache

  • echo “CloudForms - Installing apache”

  • yum -y install httpd wget

  • service httpd start

  • chkconfig httpd on

  • sed -i ‘s/

    Red Hat Enterprise Linux/

    Welcome to Red Hat CloudForms <%=role%> Instance <%=instance_name%>/’ /var/www/error/noindex.html


#4

PXE! I think cloud-init is important enough to deservice it’s own place in the menu.


#5

I agree with @deuscapturus. I have seen more integration happening with outside PXE servers/services than using the built-in PXE functionality in Cloudforms. I have seen the need for cloud-init on many occassions regardless if something was pxe booted or cloned. This really should be an outside of the PXE menu.


#6

For more reference you can find some great cloud-init examples here: http://bazaar.launchpad.net/~cloud-init-dev/cloud-init/trunk/files/head:/doc/examples/


#7

Sorry to resurrect an old thread, but I thought some of you may have some insight. I’ve developed some cloud-init scripts that work great with standard AMI’s. However, using the official AMI’s provided by my company is an issue since cloud-init isn’t installed.

Is there a convention / capability available to automate (via ssh) the installation of CloudInit from the provision phase in CloudForms ?