CloudForms with Ansible

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 has a provisioning and a retirement workflow.

Create a Service Catalog for Ansible Playbooks

Navigate to Services -> Catalogs

navigate to service catalogs

Click on Catalogs in the accordion on the left

Click on Configuration -> Add a New Catalog

Name: Ansible

Description: Ansible Service Catalog Items

create ansible catalog

Click Add to save the new catalog

Create a Service Catalog Item for the Playbook

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

Do not select Ansible Tower! We do not use Ansible Tower in this lab, but the embedded Ansible role of CloudForms.

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: 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: 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