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

  1. Navigate to Services -> Catalogs

    navigate to service catalogs

  2. Click on Catalogs in the accordion on the left

  3. Click on Configuration -> Add a New Catalog

    Name: Ansible

    Description: Ansible Service Catalog Items

    create ansible catalog

  4. Click Add to save the new catalog

Create a Service Catalog Item for the Playbook

  1. Click on Catalog Items in the accordion on the left

    navigate to service catalog items

  2. Click on Configuration -> Add a New Catalog Item

  3. 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.

  1. 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

  2. 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

  3. Click on Add to save the catalog item