Introduction to Ansible

Introduction to Ansible

Today, every business is a digital business. Technology is your innovation engine, and delivering your applications faster helps you win. Historically, that required a lot of manual effort and complicated coordination. But today, there is Ansible - the simple, yet powerful IT automation engine that thousands of companies are using to drive complexity out of their environments and accelerate DevOps initiatives.

Red Hat CloudForms can integrate with IaaS, PaaS, public and private cloud and configuration management providers. Since version 4.2 of CloudForms, it can also integrate with Ansible Tower by Red Hat. The latest version which is 4.5, has a new “embedded Ansible” role which allows it to run Playbooks, manage credentials and retrieve Playbooks from a source control management like git.

This integration allows customers to build service catalogs from Ansible Playbooks to allow end users to easily browse, order and manage resources from Ansible. Ansible Playbooks can be used in Control Policies which can not only detect problems, but also automatically fix them.

Add a Git repository of Ansible Playbooks

To be able to run Ansible Playbooks, they have to become available in CloudForms. Custom git repositories can be used as well as Github, Gitlab or others. Other repository types like Subversion or Mercurial are planned for later versions.

  1. Navigate to Automation, Automate, Repositories.

    navigate to Ansible repositories

  2. Click on Configuration, Add New Repository

  3. Fill in the form.

    Name: Github

    Description: Example Playbooks

    URL: https://github.com/cbolz/partner-conference-2017-labs.git

    SCM Update Options: check “Update on Launch”

    add a new repository

  4. Click on Add to save the settings

It takes a few seconds for the action to complete. A pop up notification will inform you after the task was completed.

Add vCenter credentials

For one of the following labs, the Playbook needs to be able to log into the vCenter provider. For this to work, we need to store the necessary credentials.

  1. Navigate to Automation -> Ansible -> Credentials

    navigate to ansible credentials

  2. Click on Configuration -> Add New Credentials

  3. Provide the credentials in the form:

    Name: vCenter

    Credentials Type: VMware

    Username: root

    Password: r3dh4t1!

    vCenter Host: vcenter.example.com

    vcenter credentials

  4. Click Add to save the credentials

It takes a few seconds for the action to complete. A pop up notification will inform you after the task was completed.

Verify repository sync

In the meantime the repository you created should have completed the initial synchronization. Let’s check all Playbooks have been successfully imported and are available for us to use.

  1. Navigate to Automation -> Ansible -> Playbooks

    navigate to ansible Playbooks

  2. You should see a list of available Playbooks

    list of available Playbooks

If there are no Playbooks listed, check the repository was configured correctly. Click the notification icon on the top right (the little bell icon) and check if there are any errors listed. The initial import can also take a minute or two, did you wait long enough?