This article was originally published on the Red Hat Customer Portal. The information may no longer be current.
As part of the upcoming 6.2.12 release, we are adding additional support for cloud-init provisioning using the Red Hat Enterprise Virtualization (RHEV/RHV) provider.
The Cloud-init tool allows to configure the provisioned virtual machine via a configuration, that is passed to the VM though the virtualization platform (RHV in this case).
The advantage of this approach is not requiring any special configuration on the network (such as managed DHCP and TFTP) in order to finish the installation of the virtual machine, neither it requires for the Satellite to actively connect to the provisioned machine via SSH to run the finish script.
It is also faster than the network-based provisioning, as we are using an image with pre-installed operating system.
VM Template Preparation
There are two ways we can get a cloud-init ready image to our RHV instance.
The first one is using the KVM base image on from our portal and import it to the RHV. The image should already have cloud-init installed.
The second option is building the template from scratch. For that, will use a standard server installation of RHEL 7 as a base.
We install cloud-init from the rhel-7-server-rpms repository:
yum install -y cloud-init
Next, we will do some basic cloud-init configuration. By default, cloud-init tries to load the configuration from external sources. While this is being used with some cloud providers, in case of RHEV, the data are being passed to the VM via a mounted drive and the additional data sources make some unnecessary delays. Therefore, we will set the following in /etc/cloud/cloud.cfg:
datasource_list: ["NoCloud", "ConfigDrive"]
This should be just enough configuration we need to do. As the final step, I recommend following steps to make a clean VM for use as a template or clone to make sure the newly reacted VMs will start from scratch.
Preparing Satellite for the cloud-init provisioning
We assume that the Satellite was already configured to provision hosts via RHV, either using network based provisioning or finish scripts via SSH.
First of all, we need to add the newly create image to the Satellite.
In Satellite, go to Infrastructure -> Compute Resources -> Your RHV resource, in the Images tab click New Image button. Fill in the necessary details. Make sure to check the "User Data" checkbox: this way the Satellite will know to use the cloud-init template, when provisioning the VM.
Next, we will create a provisioning template that will generate the cloud-init configuration. Currently, the list of configuration options for the cloud-init is limited. However, even with the subset of commands, it's possible to do just enough for finishing the configuration. We will go to Hosts -> Provisioning Templates and create a new template:
<%#
kind: user_data
name: My Satellite RHV Cloud-init
-%>
#cloud-config
hostname: <%= @host.shortname %>
<%# Allow user to specify additional SSH key as host paramter -%>
<% if @host.params['sshkey'].present? || @host.params['remote_execution_ssh_keys'].present? -%>
ssh_authorized_keys:
<% if @host.params['sshkey'].present? -%>
- <%= @host.params['sshkey'] %>
<% end -%>
<% if @host.params['remote_execution_ssh_keys'].present? -%>
<% @host.params['remote_execution_ssh_keys'].each do |key| -%>
- <%= key %>
<% end -%>
<% end -%>
<% end -%>
runcmd:
- |
#!/bin/bash
<%= indent 4 do
snippet 'subscription_manager_registration'
end %>
<% if @host.info['parameters']['realm'] && @host.realm && @host.realm.realm_type == 'Red Hat Identity Management' -%>
<%= indent 4 do
snippet 'idm_register'
end %>
<% end -%>
<% unless @host.operatingsystem.atomic? -%>
# update all the base packages from the updates repository
yum -t -y -e 0 update
<% end -%>
<%
# safemode renderer does not support unary negation
non_atomic = @host.operatingsystem.atomic? ? false : true
pm_set = @host.puppetmaster.empty? ? false : true
puppet_enabled = non_atomic && (pm_set || @host.params['force-puppet'])
%>
<% if puppet_enabled %>
yum install -y puppet
cat > /etc/puppet/puppet.conf << EOF
<%= indent 4 do
snippet 'puppet.conf'
end %>
EOF
# Setup puppet to run on system reboot
/sbin/chkconfig --level 345 puppet on
/usr/bin/puppet agent --config /etc/puppet/puppet.conf --onetime --tags no_such_tag <%= @host.puppetmaster.blank? ? '' : "--server #{@host.puppetmaster}" %> --no-daemonize
/sbin/service puppet start
<% end -%>
phone_home:
url: <%= foreman_url('built') %>
post: []
tries: 10pp
This is an equivalent of "Satellite Kickstart Default" template written using the cloud-init modules. In the Type tab, we will select User data template and in Association tab, we will add this template for the operating system we want to assign it to. Don't forget to also go to the details of the operating system (Hosts -> Operating Systems -> Your Selected OS) and select the newly created template as User data template.
This should be enough configuration for us to start with provisioning the hosts using the cloud-init.
Next steps
As mentioned, there is still some work to be done to make availability of wider range for the cloud-init modules and we are working in upstream projects to make it happened. However, I hope that even this small addition will make your life and provisioning easier.
執筆者紹介
類似検索
Implementing best practices: Controlled network environment for Ray clusters in Red Hat OpenShift AI 3.0
Friday Five — December 12, 2025 | Red Hat
Technically Speaking | Platform engineering for AI agents
Technically Speaking | Driving healthcare discoveries with AI
チャンネル別に見る
自動化
テクノロジー、チームおよび環境に関する IT 自動化の最新情報
AI (人工知能)
お客様が AI ワークロードをどこでも自由に実行することを可能にするプラットフォームについてのアップデート
オープン・ハイブリッドクラウド
ハイブリッドクラウドで柔軟に未来を築く方法をご確認ください。
セキュリティ
環境やテクノロジー全体に及ぶリスクを軽減する方法に関する最新情報
エッジコンピューティング
エッジでの運用を単純化するプラットフォームのアップデート
インフラストラクチャ
世界有数のエンタープライズ向け Linux プラットフォームの最新情報
アプリケーション
アプリケーションの最も困難な課題に対する Red Hat ソリューションの詳細
仮想化
オンプレミスまたは複数クラウドでのワークロードに対応するエンタープライズ仮想化の将来についてご覧ください