Chapter 1. Using the Ansible plug-ins


You can use Ansible plug-ins for Red Hat Developer Hub (RHDH) to learn about Ansible, create automation projects, and access opinionated workflows and tools to develop and test your automation code. From the Red Hat Developer Hub UI, you can navigate to your Ansible Automation Platform instance, where you can configure and run automation jobs.

This document describes how to use the Ansible plug-ins for Red Hat Developer Hub. It presents a worked example of developing a playbook project for automating updates to your firewall configuration on RHEL systems.

1.1. Optional requirement

The Ansible plug-ins for Red Hat Developer Hub link to Learning Paths on the Red Hat developer portal, developers.redhat.com/learn.

To access the Learning Paths, you must have a Red Hat account and you must be able to log in to developers.redhat.com.

1.2. Dashboard navigation

When you log in to Red Hat Developer Hub (RHDH), the main RHDH menu and dashboard are displayed.

To view the dashboard for Ansible plug-ins for Red Hat Developer Hub, click Ansible in the Red Hat Developer Hub navigation panel.

Ansible plug-in dashboard

The plug-in dashboard illustrates the steps you need to take from learning about Ansible to deploying automation jobs from Ansible Automation Platform:

  • Overview displays the main dashboard page.
  • Learn provides links to resources curated by Red Hat that introduce you to Ansible and provide step-by-step examples to get you started. For more information, see Learning about Ansible.
  • Discover existing collections links to private automation hub, if configured in the plug-ins, or to automation hub hosted on the Red Hat Hybrid Cloud Console. Automation hub stores existing collections and execution environments that you can use in your projects. For more information, see Discovering existing collections.
  • Create creates new projects in your configured Source Control Management platforms such as GitHub. For more information, see Creating a project.
  • Develop links you to OpenShift Dev Spaces, if configured in the Ansible plug-ins installation. OpenShift Dev Spaces provides on-demand, web-based Integrated Development Environments (IDEs), where you can develop automation content. For more information, see Developing projects.
  • Operate connects you to Ansible Automation Platform, where you can create and run automation jobs that use the projects you have developed. For more information, see Setting up a controller project to run your playbook project.

1.3. Learning about Ansible

To learn more about getting started with automation, click Learn from the Overview page of the plug-in dashboard. The Learn page provides the following options for learning:

  • Learning Paths lists a curated selection of learning tools hosted on developers.redhat.com that guide you through the foundations of working with Ansible, the Ansible VS Code extension, and using YAML.

    You can select other Ansible learning paths from the Useful links section.

  • Labs are self-led labs that are designed to give you hands-on experience in writing Ansible content and using Ansible development tools.

1.4. Discovering existing collections

From the Overview page in the Ansible plug-ins dashboard on Red Hat Developer Hub, click Discover Existing Collections.

The links in this pane provide access to the source of reusable automation content collections that you configured during plug-in installation.

If you configured private automation hub when installing the plug-in, you can click Go to Automation Hub to view the collections and execution environments that your enterprise has curated.

If you did not configure a private automation hub URL when installing the plug-in, the Discover existing collection pane provides a link to Red Hat automation hub on console.redhat.com. You can explore certified and validated Ansible content collections on this site.

1.5. Creating a project

Prerequisite

  • Ensure you have the correct access (RBAC) to view the templates in Red Hat Developer Hub. Ask your administrator to assign access to you if necessary.

Procedure:

  1. Log in to your Red Hat Developer Hub UI.
  2. Click the Ansible A icon in the Red Hat Developer Hub navigation panel.
  3. Navigate to the Overview page.
  4. Click Create.
  5. Click Create Ansible Git Project. The Available Templates page opens.
  6. Click Create Ansible Playbook project.
  7. In the Create Ansible Playbook Project page, enter information for your new project in the form.

    You can see sample values for this form in the Example project.

    FieldDescription

    Source code repository organization name or username

    The name of your source code repository username or organization name

    Playbook repository name 

    The name of your new Git repository

    Playbook description (Optional)

    A description of the new playbook project

    Playbook project’s collection namespace

    The new playbook Git project creates an example collection folder for you. Enter a value for the collection namespace.

    Playbook project’s collection name

    The name of the collection

    Catalog Owner Name

    The name of the Developer Hub catalog item owner. This is a Red Hat Developer Hub field.

    Source code repository organization name or username

    The name of your source code repository username or organization name

    Playbook repository name

    The name of your new Git repository

    Playbook description (Optional)

    A description of the new playbook project

    System (Optional)

    This is a Red Hat Developer Hub field

    Note

    Collection namespaces must follow Python module naming conventions. Collections must have short, all lowercase names. You can use underscores in the collection name if it improves readability.

    For more information, see the Ansible Collection naming conventions documentation.

  8. Click Review.

1.6. Viewing your projects

To view the projects that you have created in the plug-in, navigate to the Overview page for the Ansible plug-in and click My Items.

1.7. Developing projects

1.7.1. Developing projects on Dev Spaces

OpenShift Dev Spaces is not included with your Ansible Automation Platform subscription or the Ansible plug-ins for Red Hat Developer Hub.

The plug-ins provide context-aware links to edit your project in Dev Spaces.

The Dev Spaces instance provides a default configuration that installs the Ansible VS Code extension and provides the Ansible command line tools. You can activate Ansible Lightspeed in the Ansible VS Code extension. For more information, refer to the Red Hat Ansible Lightspeed with IBM watsonx Code Assistant User Guide.

1.7.2. Executing automation tasks in Dev Spaces

The default configuration for Dev Spaces provides access to the Ansible command line tools.

To execute an automation task in Dev Spaces from the VSCode user interface, right-click a playbook name in the list of files and select Run Ansible Playbook via ansible-navigator run or Run playbook via ansible-playbook.

Run a playbook from VS Code

1.8. Setting up a controller project to run your playbook project

Procedure

  1. The Ansible plug-ins provide a link to Ansible Automation Platform.
  2. Log in to your Red Hat Developer Hub UI.
  3. Click the Ansible A icon in the Red Hat Developer Hub navigation panel.
  4. Click Operate to display a link to your Ansible Automation Platform instance.

    If automation controller was not included in your plug-in installation, a link to the product feature page is displayed.

  5. Click Go to Ansible Automation Platform to open your platform instance in a new browser tab.

    Alternatively, if your platform instance was not configured during the Ansible plug-in installation, navigate to your automation controller instance in a browser and log in.

  6. Log in to automation controller.
  7. Create a project in Ansible Automation Platform for the GitHub repository where you stored your playbook project. Refer to the Projects chapter of TitleControllerUserGuide.
  8. Create a job template that uses a playbook from the project that you created. Refer to the Workflow job templates chapter of TitleControllerUserGuide.
Red Hat logoGithubRedditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust. Explore our recent updates.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.