Service Catalog

Build a Service Catalog to create and delete users

In this lab we will use an Ansible Playbook to create a local user in CloudForms. This example will also demonstrate how we can define a retirement process as well. In CloudForms’ understanding of complete life cycle management, every object should have a provisioning and a retirement workflow.

Create a Service Catalog Item for the Playbook

Navigate to Services -> Catalogs

navigate to Services Catalogs

Click on Catalog Items in the accordion on the left

navigate to service catalog items

Click on Configuration -> Add a New Catalog Item

Select Ansible Playbook as “Catalog Item Type”

add catalog item ansible Playbook

Fill out the form to define the service catalog item:

Name: Create User

Description: Order this catalog item to create a new user

Display in Catalog: Yes (check the box)

Catalog: Ansible

Repository: Github

Playbook: playbooks/SimpleExample/create-user.yml

Machine Credentials: CFME Default Credentials

In the box Variables & Default Values we can enter the variables the Playbook requires:

Variable: create_user_name

Default: example

Click on the little plus icon (+) to save the variable. Repeat the process for the second variable:

Variable: create_user_password

Default: secret

Click on the little plus icon (+) to save the variable.

Dialog: create new

Dialog name: create-user

create user service dialog

Click on the tab Retirement to switch to the second page of the form.

Repository: Github

Playbook: playbooks/SimpleExample/delete-user.yml

Machine Credentials: CFME Default Credentials

There are no variables needed for retirement and the Variables & Default Values can be left empty.

create user service dialog retirement

Click on Add to save the catalog item

Order the “create user” Service Catalog Item

To make sure everything works as expected, we want to test the Catalog Item we just created.

Navigate to the Service Catalog by clicking on Services -> Catalogs

navigate to service catalog

If you followed the instructions by the letter, you’re already in this part of the UI.

Click on Service Catalog in the accordion on the left

Click on the Catalog Item you just created:

navigate to service catalog

Click Order

The default values in the form can be left alone. Optionally you can specify a different user name and password

create user order form

Click Submit

After clicking "Submit" you will be redirected to the Request Queue.

request queue after ordering create user

Monitor create user Playbook execution

When executing an Ansible Playbook with the embedded role in CloudForms, a “Service” object is automatically created. This service object gives us more details about the executed Playbook. It provides the output of the Playbook and it allows us to trigger retirement.

Navigate to Services -> My Services

navigate to my services

You should see a new tile representing the Ansible Playbook Service you just ordered

If you don’t see the tile yet, wait a minute and try again.

create user service tile

After clicking on the icon, we can see more details about the service which was created

create user service details

Since this Service does not create a Virtual Machine, the box “VMs” will always say “No Records found”

Click on the Provisioning tab to see the output of the Ansible Playbook

ansible Playbook output

If the Playbook execution has not completed, you can click the reload icon to refresh the information. The Reload icon is represented by a little arrow, left of the Configuration menu.

reload icon

If the Playbook execution has not started yet, you might not see any details in the “Provisioning” tab. Wait a minute and reload once more.

Verify Playbook results

To make sure the user was really created, follow these steps.

Click on your username on the top right and click on Configuration

navigate to configuration

Click on Access Control in the accordion on the left

navigate to access control

Click on Users and you should see the user you just created (in this screenshot the user is called “example”)

user example exists

If you want, you can log out of CloudForms and try to log in with the user you just created. Click on your username on the top right and Logout.