<?xml version="1.0" encoding="UTF-8" standalone="yes"?><oembed><version><![CDATA[1.0]]></version><provider_name><![CDATA[CloudForms Now]]></provider_name><provider_url><![CDATA[http://cloudformsblog.redhat.com]]></provider_url><author_name><![CDATA[Jerome Marc]]></author_name><author_url><![CDATA[https://cloudformsblog.redhat.com/author/jeromemarc/]]></author_url><title><![CDATA[Publishing an Ansible Job Template as a Service in&nbsp;CloudForms]]></title><type><![CDATA[link]]></type><html><![CDATA[<p>This is part 4 of our series on <a href="http://cloudformsblog.redhat.com/2016/07/22/ansible-tower-in-cloudforms/">Ansible Tower Integration in Red Hat CloudForms</a>.</p>
<p>In the <a href="http://cloudformsblog.redhat.com/2016/08/05/launch-ansible-job-from-cloudforms-vm-button/">previous article</a>, we have seen how Ansible Job Templates can be launched from a VM button in CloudForms. In this article, we explore how Ansible Job Templates can be published as Catalog Items and made available for end user consumption from a CloudForms Service Catalog.</p>
<p>In this example, we use <a href="http://docs.ansible.com/ansible/ec2_elb_lb_module.html">ec2_elb_lb</a>, an Ansible core module, to demonstrate how we can easily extend the capabilities of CloudForms by re-using automation already provided by Ansible. In particular, we provide the ability to create an Amazon Elastic Load Balancer (ELB) from CloudForms Service Catalog without having to write any Ruby code.</p>
<p><!--more--></p>
<p>A simple Ansible Playbook for this example can be found on <a href="https://github.com/jeromemarc/cloudforms-ansible-tower">GitHub</a> and imported into Ansible Tower. A ‘Create AWS ELB’ Job Template is created with this playbook, allowing the end user to specify input values for the name of the ELB and a list of instances to associate to the new load balancer (as an extra variable called elb_name and instance_ids on the Job Template).</p>
<p>In CloudForms, we can auto-generate a dialog following the steps from our <a href="http://cloudformsblog.redhat.com/2016/08/05/launch-ansible-job-from-cloudforms-vm-button/">previous article</a> from ‘Configuration &gt; Configuration Management &gt; Ansible Tower Job Templates &gt; Create AWS ELB’ and selecting ‘Create Service Dialog from this Job Template’ from the ‘Configuration’ button.</p>
<p>The generated Service Dialog can be edited. In our case, we can remove the limit field (as this Ansible Job does not require to run on a particular host) and remove the ‘read-only’ option from  the other fields.</p>
<p>&nbsp;</p>
<p><img data-attachment-id="1110" data-permalink="https://cloudformsblog.redhat.com/2016/07/22/ansible-tower-in-cloudforms/image40/" data-orig-file="https://cloudformsredhat.files.wordpress.com/2016/07/image40.png?w=354&#038;h=225" data-orig-size="354,225" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="image40" data-image-description="" data-medium-file="https://cloudformsredhat.files.wordpress.com/2016/07/image40.png?w=354&#038;h=225?w=300" data-large-file="https://cloudformsredhat.files.wordpress.com/2016/07/image40.png?w=354&#038;h=225?w=354" class="aligncenter wp-image-1110 size-full" style="border:1px solid #000000;" src="https://cloudformsredhat.files.wordpress.com/2016/07/image40.png?w=354&#038;h=225" alt="Simple AWS ELB Dialog" width="354" height="225" srcset="https://cloudformsredhat.files.wordpress.com/2016/07/image40.png 354w, https://cloudformsredhat.files.wordpress.com/2016/07/image40.png?w=150&amp;h=95 150w, https://cloudformsredhat.files.wordpress.com/2016/07/image40.png?w=300&amp;h=191 300w" sizes="(max-width: 354px) 100vw, 354px" /></p>
<p>&nbsp;</p>
<p>Next, we create a Service Item by navigating to ‘Services &gt; Catalogs &gt; Catalog Items’ and selecting ‘Add a new Catalog Item’ from the ‘Configuration’ button. You will notice in CloudForms 4.1 that new Catalog Item Types are introduced. We select ‘AnsibleTower’ in our example, which causes CloudForms to present us with a dialog prompting for Ansible Tower related details.</p>
<p>&nbsp;</p>
<p><img data-attachment-id="1106" data-permalink="https://cloudformsblog.redhat.com/2016/07/22/ansible-tower-in-cloudforms/image36/" data-orig-file="https://cloudformsredhat.files.wordpress.com/2016/07/image36.png?w=478&#038;h=356" data-orig-size="478,356" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="Adding a new Service Catalog Item" data-image-description="" data-medium-file="https://cloudformsredhat.files.wordpress.com/2016/07/image36.png?w=478&#038;h=356?w=300" data-large-file="https://cloudformsredhat.files.wordpress.com/2016/07/image36.png?w=478&#038;h=356?w=478" class="aligncenter wp-image-1106 size-full" style="border:1px solid #000000;" src="https://cloudformsredhat.files.wordpress.com/2016/07/image36.png?w=478&#038;h=356" alt="Adding a new Service Catalog Item" width="478" height="356" srcset="https://cloudformsredhat.files.wordpress.com/2016/07/image36.png 478w, https://cloudformsredhat.files.wordpress.com/2016/07/image36.png?w=150&amp;h=112 150w, https://cloudformsredhat.files.wordpress.com/2016/07/image36.png?w=300&amp;h=223 300w" sizes="(max-width: 478px) 100vw, 478px" /></p>
<p>&nbsp;</p>
<p>We populate the name and description, and select a Catalog (previously created) where we want our new Service Item to be displayed. For the Dialog field, we select the Service Dialog we just created. The Provider and Ansible Tower Job Template fields are specific to the AnsibleType catalog item type and specify which Ansible Tower provider to reach out to as well as which Ansible Job Template to launch when the Catalog Item is ordered. In our example, we select our Ansible Tower provider from the drop down list and our ‘Create AWS ELB’ from the Job Template drop down (automatically populated with all available job templates). The Provisioning Entry Point State Machine can remain as default.<br />
<img data-attachment-id="1090" data-permalink="https://cloudformsblog.redhat.com/2016/07/22/ansible-tower-in-cloudforms/image20/" data-orig-file="https://cloudformsredhat.files.wordpress.com/2016/07/image20.png?w=981&#038;h=501" data-orig-size="981,501" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="CloudForms Deploy PostgreSQL" data-image-description="" data-medium-file="https://cloudformsredhat.files.wordpress.com/2016/07/image20.png?w=981&#038;h=501?w=300" data-large-file="https://cloudformsredhat.files.wordpress.com/2016/07/image20.png?w=981&#038;h=501?w=981" class="aligncenter wp-image-1090 size-full" style="border:1px solid #000000;" src="https://cloudformsredhat.files.wordpress.com/2016/07/image20.png?w=981&#038;h=501" alt="Editing Service Catalog Item Deploy PostgreSQL" width="981" height="501" srcset="https://cloudformsredhat.files.wordpress.com/2016/07/image20.png 981w, https://cloudformsredhat.files.wordpress.com/2016/07/image20.png?w=150&amp;h=77 150w, https://cloudformsredhat.files.wordpress.com/2016/07/image20.png?w=300&amp;h=153 300w, https://cloudformsredhat.files.wordpress.com/2016/07/image20.png?w=768&amp;h=392 768w" sizes="(max-width: 981px) 100vw, 981px" /></p>
<p>&nbsp;</p>
<p>Once saved, we can change the icon for the Service Item and make it available to our end users. In this example, we have created a specific group and role and configured service visibility by tag. Our Service Item is available in CloudForms Self-Service portal.</p>
<p>&nbsp;</p>
<p><img data-attachment-id="1091" data-permalink="https://cloudformsblog.redhat.com/2016/07/22/ansible-tower-in-cloudforms/image21/" data-orig-file="https://cloudformsredhat.files.wordpress.com/2016/07/image21.png?w=1183&#038;h=525" data-orig-size="1183,525" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="CloudForms Self-Service Create new AWS ELB" data-image-description="" data-medium-file="https://cloudformsredhat.files.wordpress.com/2016/07/image21.png?w=1183&#038;h=525?w=300" data-large-file="https://cloudformsredhat.files.wordpress.com/2016/07/image21.png?w=1183&#038;h=525?w=1024" class="aligncenter wp-image-1091 size-full" style="border:1px solid #000000;" src="https://cloudformsredhat.files.wordpress.com/2016/07/image21.png?w=1183&#038;h=525" alt="CloudForms Self-Service Create new AWS ELB" width="1183" height="525" srcset="https://cloudformsredhat.files.wordpress.com/2016/07/image21.png 1183w, https://cloudformsredhat.files.wordpress.com/2016/07/image21.png?w=150&amp;h=67 150w, https://cloudformsredhat.files.wordpress.com/2016/07/image21.png?w=300&amp;h=133 300w, https://cloudformsredhat.files.wordpress.com/2016/07/image21.png?w=768&amp;h=341 768w, https://cloudformsredhat.files.wordpress.com/2016/07/image21.png?w=1024&amp;h=454 1024w" sizes="(max-width: 1183px) 100vw, 1183px" /></p>
<p>&nbsp;</p>
<p>The user can order the service by specifying input values, adding it to the shopping cart and checking it out.</p>
<p>&nbsp;</p>
<p><img data-attachment-id="1107" data-permalink="https://cloudformsblog.redhat.com/2016/07/22/ansible-tower-in-cloudforms/image37/" data-orig-file="https://cloudformsredhat.files.wordpress.com/2016/07/image37.png?w=1185&#038;h=575" data-orig-size="1185,575" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="CloudForms Self-Service Create new AWS ELB Dialog" data-image-description="" data-medium-file="https://cloudformsredhat.files.wordpress.com/2016/07/image37.png?w=1185&#038;h=575?w=300" data-large-file="https://cloudformsredhat.files.wordpress.com/2016/07/image37.png?w=1185&#038;h=575?w=1024" class="aligncenter wp-image-1107 size-full" style="border:1px solid #000000;" src="https://cloudformsredhat.files.wordpress.com/2016/07/image37.png?w=1185&#038;h=575" alt="CloudForms Self-Service Create new AWS ELB Dialog" width="1185" height="575" srcset="https://cloudformsredhat.files.wordpress.com/2016/07/image37.png 1185w, https://cloudformsredhat.files.wordpress.com/2016/07/image37.png?w=150&amp;h=73 150w, https://cloudformsredhat.files.wordpress.com/2016/07/image37.png?w=300&amp;h=146 300w, https://cloudformsredhat.files.wordpress.com/2016/07/image37.png?w=768&amp;h=373 768w, https://cloudformsredhat.files.wordpress.com/2016/07/image37.png?w=1024&amp;h=497 1024w" sizes="(max-width: 1185px) 100vw, 1185px" /></p>
<p>&nbsp;</p>
<p>Upon ordering, CloudForms launches the Job Template via Ansible Tower passing the dialog values and receives a notification from Ansible Tower once complete. A new Amazon Elastic Load Balancer is deployed.</p>
<p>In this article, we looked at how to publish an Ansible Tower Job Template in a CloudForms Service Catalog. We successfully ordered this service from CloudForms Self-Service portal. In the following article, we will go further and explore how to use Ansible Service Items as part of a CloudForms Service Bundle and automatically launch Job Templates on newly provisioned VMs.</p>
]]></html><thumbnail_url><![CDATA[https://cloudformsredhat.files.wordpress.com/2016/07/image40.png?fit=440%2C330]]></thumbnail_url><thumbnail_width><![CDATA[354]]></thumbnail_width><thumbnail_height><![CDATA[225]]></thumbnail_height></oembed>