Deploying CloudForms in the Azure Cloud

redhat-ms

Overview

In this article we will deploy the CloudForms appliance in the Azure cloud. CloudForms is a cloud management platform based on the opensource project manageiq. Red Hat bought manageiq a few years back and opensourced the software. Originally it was designed to manage VMware but over the years has expanded to many additional traditional as well as cloud platforms. You can use this article as reference for both CloudForms and ManageIQ.

CloudForms can connect to many cloud providers such as RHEV (Red Hat Enterprise Virtualization), VMware, Hyper-V, OpenStack, Amazon Web Services (AWS), Google Cloud Engine (GCE) and Azure. Large organizations don’t have one cloud but many and in addition typically have on-premise, off-premise as well as public. All of these various platforms creates a lot of complexity if not managed right. CloudForms can create a bridge between traditional (mode 1) and cloud native (mode 2) workloads, offering applications a path to switch between these modes. In addition, CloudForms allows an IT organization to act as a cloud broker between the various public platforms. Finally CloudForms can be used to automatically deploy and manage applications across the various cloud platforms. Businesses have choice in platform, flexibility and speed while IT can manage it all centrally applying common policies or rule-sets regardless of where workloads are running.

Prepare

Red Hat provides CloudForms as a appliance. The appliances each have various formats, depending on the platform. For Microsft Hyper-V and Azure, Red Hat provides a Virtual Hard Disk (VHD). The vhd is a dynamic disk. Azure unfortunately does not support dynamic disks but only fixed disks. In order to import CloudForms appliance in Azure we need to convert the appliance vhd to fixed disk. In addition the vhd will be fixed size of around 40GB. To prevent having to upload 40GB and just the actual data which is closer to 2GB we will use several tools. You can of course use Powershell, using the Azure cmdlets. If you are a Linux guy like me though, that isn’t an option. Thankfully Microsoft has provided a tool written in Go that works great for uploading disks to Azure. In addition Microsoft provides a CLI similar to functionality of Powershell written in python.

Convert VHD from dynamic to fixed

The first question you might have is why? Well Red Hat doesn’t want you to have to download a 40GB image so they provide a dynamic disk. In the next steps we will take that image, convert to fixed disk and upload to Azure, ignoring the zero’ed blocks.

Convert image to raw using qemu tools

# qemu-img convert -f vpc -O raw cfme-azure-5.7.0.17-1.x86_64.vhd cfme-azure-5.7.0.17-1.raw

Calculate fixed image size

$sudo rawdisk="cfme-azure-5.7.0.17-1.raw"
$sudo vhddisk="cfme-azure-5.7.0.17-1.vhd"
$sudo MB=$((1024*1024))
$sudo rounded_size=$((($size/$MB + 1)*$MB))
$sudo size=$(qemu-img info -f raw --output json "$rawdisk" | gawk 'match($0, /"virtual-size": ([0-9]+),/, val) {print val[1]}')
$sudo rounded_size=$((($size/$MB + 1)*$MB))

Resize image

$sudo qemu-img resize -f raw "$rawdisk" $rounded_size
$sudo qemu-img convert -f raw -o subformat=fixed,force_size -O vpc "$rawdisk" "$vhddisk"

Download Azure VHD Tools

As mentioned the Azure VHD tools are written in Go so you need to first install Go. I installed version 1.7.4.

$ gunzip go1.7.4.linux-amd64.tar.gz 
$ tar xvf go1.7.4.linux-amd64.tar 
$ cd go

Export Environment Parameters

 $ mkdir $HOME/work
 $ export GOPATH=$HOME/work
 $ export PATH=$PATH:$GOPATH/bin

Install VHD Tools

 $ go get github.com/Microsoft/azure-vhd-utils

Upload the CloudForms Fixed Disk to Azure

$ ./azure-vhd-utils upload --localvhdpath /home/ktenzer/cfme-azure-5.7.0.17-1.vhd --stgaccountname <storage account> --stgaccountkey <storage key> --containername templates --blobname cfme-azure-5.7.0.17-1.vhd --parallelism 8

Once the upload completes you can deploy the CloudForms Appliance in Azure. In order to do this we will use the Azure CLI which is python based.

Install Python and dependencies

$ sudo yum install python
$ sudo yum install python-pip
$ sudo yum install python-devel
$ sudo yum install openssl-devel
$ sudo yum install npm

Install Azure CLI

$ npm install azure-cli -g
$ sudo npm install azure-cli -g
$ sudo pip install --upgrade pip
$ sudo pip install azure==2.0.0rc5

Deploy CloudForms Appliance

Using the Azure CLI deploy CloudForms Appliance

$ azure vm image create cfme-azure-5.7.0.17-1 --blob-url https://premiumsadpdhlose2disk.blob.core.windows.net/templates/cfme-azure-5.7.0.17-1.vhd --os Linux /home/ktenzer/cfme-azure-5.7.0.17-1.vhd

Note: you can also use the Azure portal UI to create VM once the image is uploaded.

Configure CloudForms in Azure

Once the CloudForms Appliance is deployed you can access it using username/password or ssh-key depending on what you chose when creating VM in Azure.

$ ssh ktenzer@<CloudForms Appliance IP>

Run the appliance console

$ sudo appliance_console

Welcome to the CFME Virtual Appliance.

To modify the configuration, use a web browser to access the management page.

Hostname: CFME
IP Address: 10.0.0.9
Netmask: 255.255.255.0
Gateway: 10.0.0.1
Primary DNS: 168.63.129.16
Secondary DNS: 
Search Order: v1tt5gv0hqjudfkkftdccsm4cc.ax.internal.cloudapp.net
MAC Address: 00:0d:3a:28:0c:27
Timezone: Europe/Berlin
Local Database Server: running (primary)
CFME Server: running
CFME Database: localhost
Database/Region: vmdb_production / 1
External Auth: not configured
CFME Version: 5.7.0.17


Press any key to continue.
Advanced Setting

1) Set DHCP Network Configuration
2) Set Static Network Configuration
3) Test Network Configuration
4) Set Hostname
5) Set Timezone
6) Set Date and Time
7) Restore Database From Backup
8) Configure Database
9) Configure Database Replication
10) Configure Database Maintenance
11) Logfile Configuration
12) Configure Application Database Failover Monitor
13) Extend Temporary Storage
14) Configure External Authentication (httpd)
15) Update External Authentication Options
16) Generate Custom Encryption Key
17) Harden Appliance Using SCAP Configuration
18) Stop EVM Server Processes
19) Start EVM Server Processes
20) Restart Appliance
21) Shut Down Appliance
22) Summary Information
23) Quit

Choose the advanced setting:

Verify the network configuration, hostname and timezone.

Configure database

Configure Database

Database Operation

1) Create Internal Database
2) Create Region in External Database
3) Join Region in External Database
4) Reset Configured Database

Choose the database operation:

Create an internal database, choosing default options

Once database has been created and instantiated start the EVM processes from main menu. Once that completes you can access the CloudForms Appliance UI.

https://<CloudForms Appliance IP>
username: admin
password: smartvm

Summary

In this article we explored how to deploy the CloudForms appliance in the Azure cloud. CloudForms can provide insights into many cloud providers and provide a single-pane for administrating an organizations various cloud platforms. This enables an IT organization to take the role of cloud broker, providing an organization flexibility between various platforms without giving up control and oversight. I hope you found this article of use. If you have additional feedback or comments please let me know.

Happy Clouding in Azure!

(c) 2017 Keith Tenzer

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s