In this post, we will show you how to make your service catalog descriptions more elegant and flexible in Red Hat CloudForms. If you just type a description, along with a long description, you’ll get something like this:
This is fine, it&8217;s informative and simple. But we could improve on it.
The Long Description field in a CloudForms catalog item can take raw HTML. This means we can add some additional changes like font size and bold text. Here is a more complex catalog item for example:
The Implementation
Really there isn&8217;t much limit on what you can do with these other than your imagination and HTML skills. Just be aware that global style tags will not function in the self-service UI, but inline formatting works just fine. Some options, like the one above, might just add a bit of aesthetic sugar, but more complex services, especially those that will be presented to customers, can be complemented by an informative and attractive description.
For example, let’s say we have a service that provisions two virtual machines and a load balancer. We could use the following HTML:
<!DOCTYPE html>
<html>
<body>
<h1>Create 2 Virtual Machines under a Load balancer and configure Load Balancing rules
for the VMs</h1>
<p>This template allows you to create 2 Virtual Machines under a Load balancer and
configure a load balancing rule on Port 80. This template also deploys a Storage
Account, Virtual Network, Public IP address, Availability Set and Network
Interfaces.</p>
<p>In this template, we use the resource loops capability to create the network
interfaces and virtual machines</p>
</body>
</html>
Which would give us something like this:
Take a look at how it’s displayed in the self service UI, both when hovering over the information link:
And on the order page itself:
As you develop more complex services, the value of these features will become more and more apparent.
A More Complex Example
Let’s take a look at a service that deploys and configures multiple virtual machines in Microsoft Azure and sets up Ansible to manage them. Everything you need to create this service can be found on the GitHub page with the Orchestration Template. Especially since we can automatically generate service dialogs from these templates. This code:
<!DOCTYPE html>
<html>
<body>
<h1>Advanced Linux Ansible Template: Setup Ansible to efficiently manage N Linux VMs</h1>
<p>This advanced template deploys N Linux VMs (Ubuntu) and it configures Ansible so you
can easily manage all the VMS . Don’t suffer more pain configuring and managing all
your VMs, just use Ansible! Ansible is a very powerful masterless configuration
management system based on SSH.</p>
<p>This template creates a storage account (Standard or Premium storage), a Virtual
Network, an Availability Sets (3 Fault Domains and 10 Update Domains), one private
NIC per VM, one public IP, a Load Balancer and you can specify SSH keys to access
your VMS remotely from your latop. You will need an additional certificate / public
key for the Ansible configuration, before executing the template you have upload them
to a Private Azure storage account in a container named ssh.</p>
<p>The template uses two Custom Scripts :</p>
<ul>
<li>The first script configures SSH keys (public) in all the VMs for the Root user
so you can manage the VMS with ansible.</li>
<li>The second script installs ansible on a A1/DS1 Jumpbox VM so you can use it as a
controller.The script also deploys the provided certificate to /root/.ssh. Then,
it will execute an ansible playbook to create a RAID with all the available
disks.</li>
<li><p>Before you execute the script, you will need to create a PRIVATE storage
account and a container named ssh, and upload your certificate and public keys
for Ansible/ssh. </p>
<p>Once the template finishes, ssh into the AnsibleController VM (by defult the
load balancer has a NAT rule using the port 64000), then you can manage your VMS
with Ansible and the root user. For instance: </p>
<pre><code>sudo su root
ansible all -m ping (to ping all the VMs)
or
ansible all -m setup (to show all VMs system info )
</code></pre></li>
</ul>
<p>This template also ilustrates how to use Outputs and Tags.</p>
<ul>
<li>The template will generate an output with the fqdn of the new public IP so you
can easily connect to the Ansible VM.</li>
<li>The template will associate two tags to all the VMS : ServerRole (Webserver,
database etc) and ServerEnvironment (DEV,PRE,INT, PRO etc)</li>
</ul>
<h2>Known Issues and Limitations</h2>
<ul>
<li>Fixed number of data disks.This is due to a current limitation on the resource
manager; this template creates 2 data disks with ReadOnly Caching</li>
<li>Only the Ansible controller VM will be accesible for SSH.</li>
<li>Scripts are not yet idempotent and cannot handle updates.</li>
<li>Current version doesn’t use secured endpoints. If you are going to host
confidential data make sure that you secure the VNET by using Security
Groups.</li>
</ul>
</body>
</html>
Renders the following:
And this is how it looks in the self service UI order page:
Additional Notes
When developing descriptions like these, it can be a bit frustrating to have to edit and save your long descriptions to see how your work is coming along. I like to use this online editor or the Try It editor from w3schools. That way you can see your results quickly and get close to what you&8217;re looking for before building the catalog item in CloudForms. The site is also a great reference for HTML syntax. You can use these editors to build things like tables that can more efficiently describe your services to the service consumer in the most efficient way possible, as in this example:
That’s the basic idea. The built-in features of CloudForms to allow service designers to utilize HTML in their service descriptions gives us the tools we need to create more informative, as well as professional looking, catalog items. Try it out with some of your existing services and I suspect you’ll find it’s quite easy to improve your overall presentation with very little effort.
Quelle: CloudForms
Published by