Red Hat Ansible Lightspeed with IBM watsonx Code Assistant User Guide


Red Hat Ansible Lightspeed with IBM watsonx Code Assistant 2.x_latest

Learn how to use Red Hat Ansible Lightspeed with IBM watsonx Code Assistant.

Red Hat Customer Content Services

Abstract

This guide shows you how to use Red Hat Ansible Lightspeed with IBM watsonx Code Assistant.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. We are beginning with these four terms: master, slave, blacklist, and whitelist. Because of the enormity of this endeavor, these changes will be implemented gradually over several upcoming releases. For more details, see our CTO Chris Wright’s message.

Learn about Red Hat Ansible Lightspeed with IBM watsonx Code Assistant, its benefits, key features, process, and data gathered to train the IBM watsonx Code Assistant models.

1.1. About Red Hat Ansible Lightspeed

Red Hat Ansible Lightspeed with IBM watsonx Code Assistant is a generative AI service that helps automation teams create, adopt, and maintain Ansible content more efficiently. It uses natural language prompts to generate code recommendations for automation tasks based on Ansible best practices.

Red Hat Ansible Lightspeed is the cloud service that enables integration of generative AI into Ansible Automation Platform. This document specifically describes the integration of Red Hat Ansible Lightspeed with IBM watsonx Code Assistant.

Red Hat Ansible Lightspeed uses IBM watsonx Code Assistant models trained on subject matter expertise across the Ansible ecosystem, which includes Galaxy, GitHub, and Ansible certified and validated content. For ease of use, Red Hat Ansible Lightspeed is integrated with your existing Ansible developer workflows. For example, you can use your existing Git repositories (both public and private) to train your IBM watsonx Code Assistant models. You can also access Lightspeed content suggestions in VS Code through the Ansible VS code extension.

  • Red Hat Ansible Lightspeed cloud service

    To use the Red Hat Ansible Lightspeed cloud service, you must meet one of the following requirements:

    • Your organization has a trial or paid subscription to both the Red Hat Ansible Automation Platform and IBM watsonx Code Assistant.
    • Your organization has a trial or paid subscription to the Red Hat Ansible Automation Platform, and you have a Red Hat Ansible Lightspeed trial account.

      Note

      A Red Hat Ansible Lightspeed trial account does not require an IBM watsonx Code Assistant subscription.

  • Red Hat Ansible Lightspeed on-premise deployment

    To use an on-premise deployment of Red Hat Ansible Lightspeed, your organization must have the following subscriptions:

    • A trial or paid subscription to the Red Hat Ansible Automation Platform
    • An installation of IBM watsonx Code Assistant for Red Hat Ansible Lightspeed on Cloud Pak for Data

Red Hat Ansible Lightspeed with IBM watsonx Code Assistant offers the following benefits:

  • Reduces the onboarding learning period for Ansible developers

    With just a basic understanding of YAML syntax, Ansible developers can use natural language prompts in English language to describe the automation goal. Red Hat Ansible Lightspeed then offers Ansible code recommendations to help achieve the automation goal more efficiently. This combination of content and best practice suggestions reduces the learning curve and offers a smoother onboarding experience for new Ansible users.

    For example, to get a multitask code recommendation, you can enter the prompt Install postgresql-server & run postgresql-setup command. The Ansible Lightspeed service reads the text, interacts with IBM watsonx Code Assistant, and generates code recommendations to automate a multitask that installs a PostgreSQL server and sets up a PostgreSQL database. You can then view and accept the code recommendations to create tasks in an Ansible YAML file.

  • Increases productivity with quality content creation

    Red Hat Ansible Lightspeed offers automation code recommendations that adhere to Ansible best practices, and IBM watsonx Code Assistant provides model fine-tuning features to improve the accuracy of suggested content based on your organization’s existing Ansible content. Therefore, the AI-generated code recommendations are more accurate, more reliable, and integrated with your existing automation development workflows.

  • Extends trust with AI-generated code recommendations

    The AI-generated code recommendations enable you to extend trust, with an automation code base that adheres to accepted Ansible best practices and significant data safeguards.

1.2. Key features of Red Hat Ansible Lightspeed

Red Hat Ansible Lightspeed offers the following key features:

  • Ansible-specific IBM watsonx Code Assistant models

    Red Hat Ansible Lightspeed with IBM watsonx Code Assistant uses Ansible-specific IBM watsonx Granite models unique to your organization, which are provided, managed, and maintained by IBM.

  • Model customization

    Organization administrators can now create and use fine-tuned, custom models that are trained on your organization’s existing Ansible content. With this capability, you can tune the models to your organization’s automation patterns and improve the code recommendation experience.

    You can configure multiple custom models for your organization. For example, you can create a custom model for your corporate IT automation team and a different one for your engineering team’s infrastructure. You can also configure a custom model to make it available for all Ansible users or select Ansible users in your organization.

  • Red Hat Ansible Lightspeed cloud service and on-premise deployments

    Red Hat Ansible Lightspeed is available both as a cloud service and as an on-premise deployment. Red Hat Ansible Lightspeed on-premise deployments provide the Red Hat Ansible Automation Platform customers more control over their data and supports compliance with enterprise security policies. For example, organizations in sensitive industries with data privacy or air-gapped requirements can use on-premise deployments of both Red Hat Ansible Lightspeed and IBM watsonx Code Assistant for Red Hat Ansible Lightspeed on Cloud Pak for Data. Red Hat Ansible Lightspeed on-premise deployments are supported on Red Hat Ansible Automation Platform version 2.4 and later.

  • Red Hat Ansible Lightspeed trial

    Existing Ansible users can now start a free 90-day Red Hat Ansible Lightspeed cloud service trial. You can create single-task and multitask recommendations, generate playbooks, and view playbook explanations with a trial account.

    To start your Red Hat Ansible Lightspeed trial, you need a trial or paid subscription to the Red Hat Ansible Automation Platform; however, you do not need a trial or paid subscription to IBM watsonx Code Assistant. For more information, see Starting a trial of Red Hat Ansible Lightspeed.

  • Playbook and task generation

    This includes the following capabilities:

    • Playbook generation and explanations

      Using the Ansible VS Code extension, you can create Ansible playbooks using a natural language interface in English. Red Hat Ansible Lightspeed with IBM watsonx Code Assistant reads the natural language prompts and generates an entire playbook recommendation based on your intent. You can also view the explanations for new or existing playbooks. The playbook explanations describe what the playbook or task within the playbook does and contextualize its impact.

    • Single and multitask generation

      Using natural language prompts, you can generate single task or multiple task recommendations for Ansible task files and playbooks. To request multitask code recommendations, you can enter a sequence of natural language task prompts in a YAML file comment separated by ampersand (&) symbols.

      Currently, Red Hat Ansible Lightspeed supports user prompts in English language only. However, there could be instances where the training data that was used to train the IBM watsonx Code Assistant models included non-English language. In such scenarios, the model can generate code recommendations for prompts made in the same non-English language, but the generated code recommendations might or might not be accurate.

  • Content source matching

    For each generated code recommendation, Red Hat Ansible Lightspeed lists content source matches, including details such as potential source, content author, and relevant licenses. You can use this data to gain insight into potential training data sources used to generate the code recommendations.

  • Post-processing capabilities

    Red Hat Ansible Lightspeed offers post-processing capabilities that augment IBM watsonx Code Assistant and improve the quality and accuracy of code recommendations.

  • Content maintenance and modernization

    The Ansible code bot scans existing content collections, roles, and playbooks through Git repositories, and proactively creates pull requests whenever best practices or quality improvement recommendations are available. The bot automatically submits pull requests to the repository, which proactively alerts the repository owner to a recommended change to their content.

  • Telemetry data collection on the Admin dashboard

    Red Hat Ansible Lightspeed now collects Admin dashboard telemetry data that provides insight into how your organization users are using the Ansible Lightspeed service, and displays the metrics on the Admin dashboard. If you no longer want to collect and manage the Admin dashboard telemetry, you can disable it for your organization.

1.3.1. Prerequisites

To use the Red Hat Ansible Lightspeed cloud service, you must meet one of the following requirements:

  • Your organization has a trial or paid subscription to both the Red Hat Ansible Automation Platform and IBM watsonx Code Assistant.
  • Your organization has a trial or paid subscription to the Red Hat Ansible Automation Platform, and you have a Red Hat Ansible Lightspeed trial account.

    Note

    A Red Hat Ansible Lightspeed trial account does not require an IBM watsonx Code Assistant subscription.

To use an on-premise deployment of Red Hat Ansible Lightspeed, your organization must have the following subscriptions:

  • A trial or paid subscription to Red Hat Ansible Automation Platform
  • An installation of IBM watsonx Code Assistant for Red Hat Ansible Lightspeed on Cloud Pak for Data

You must also install the following components:

  • VS Code version 1.70.1 or later
  • The Ansible extension for VS Code version 2.8 or later

1.3.2. Connectivity requirements

To generate code recommendations, the Ansible Lightspeed service in Visual Studio (VS) Code editor requires access to the following outbound domain:

The outbound connections are encrypted on TCP protocol port 443.

1.4.1. Models

Red Hat Ansible Lightspeed with IBM watsonx Code Assistant uses Ansible-specific IBM watsonx Granite models unique to your organization. These models are provided, managed, and maintained by IBM.

1.4.2. Data sources

IBM watsonx Code Assistant models are trained on Ansible content from Ansible Galaxy, data from public Git repositories, and Red Hat Ansible subject matter expert examples.

If you publish content to Ansible Galaxy and want to restrict your Ansible Galaxy content from being used to train the models, you can opt out of sharing your Ansible Galaxy data in the Ansible Galaxy namespace configuration.

1.4.3. Data telemetry

Red Hat Ansible Lightspeed collects the following telemetry data by default:

  • Operational telemetry data
  • Admin dashboard telemetry data
Note

No telemetry data is collected in an Red Hat Ansible Lightspeed on-premise deployment.

In connection with your use of this Red Hat offering, Red Hat may collect telemetry data about your use of the software. This data allows Red Hat to monitor the software and to improve Red Hat offerings and support, including identifying, troubleshooting, and responding to issues that impact users. The data may also be used to enable you to track your entitlements to Red Hat subscriptions and take advantage of future Red Hat purchasing programs. It may also allow Red Hat to assist you in implementing upgrades to minimize service impact. The data may be shared internally within Red Hat to improve the user experience. If you are evaluating Red Hat software, the data will help Red Hat determine if you need assistance.

1.4.4.1. What information does Red Hat collect?

Tools within the software monitor various metrics and this information is transmitted to Red Hat. The following metrics are monitored:

  • Operational telemetry data

    This is the data that is required to operate and troubleshoot the Ansible Lightspeed service. For more information, refer the Enterprise Agreement. You cannot disable the collection of operational telemetry data.

    This includes the following data:

    • Organization you are logged into (Organization ID, account number)
    • Large language model (or models) that you are connected to
  • Admin dashboard telemetry data

    This is the data that provides insight into how your organization users are using the Ansible Lightspeed service, and the metrics are displayed on the Admin dashboard.

    This includes the following data:

    • Prompts and content suggestions, including accept or reject of the content suggestions
    • User sentiment feedback

      You can also disable the Admin dashboard telemetry if you no longer want to collect and monitor the telemetry data. For more information about Admin dashboard telemetry, see Viewing and managing Admin dashboard telemetry.

Note

No telemetry data is collected in an Red Hat Ansible Lightspeed on-premise deployment.

1.4.4.2. Personal Data

Red Hat does not intend to collect personal information. If Red Hat discovers that personal information has been inadvertently received, Red Hat will delete such information. To the extent that any telemetry data constitutes personal data, refer to the Red Hat Privacy Statement for more information about Red Hat’s privacy practices.

  • Retention

    Red Hat retains and stores telemetry data only for as long as it’s needed for the purposes described above or as otherwise required or permitted by law.

  • Data security

    Red Hat employs technical and organizational measures designed to protect the telemetry data. Data stored in the Red Hat cloud is being protected, where possible, through encryption. Data is also segmented, and therefore is not accessible across organizations.

  • Data sharing

    Red Hat may share telemetry data with its business partners in an aggregated form that does not identify customers to help the partners better understand their markets and their customer’s use of Red Hat offerings or ensure the successful integration of products jointly supported by those partners.

  • Third Party Service Providers

    Red Hat may engage certain service providers to assist in the collection and storage of the telemetry data.

  • User control/ enabling and disabling Admin Dashboard telemetry collection

    You cannot disable collection of operational telemetry data. Operational telemetry data includes only data that is necessary to operate and troubleshoot the service. However, you can disable the collection of Admin Dashboard telemetry data. For more information, see Disabling the Admin dashboard telemetry.

Red Hat Ansible Lightspeed cloud service provides a free 90-day trial for existing Ansible users. To start a free trial, you need a trial or paid subscription to the Red Hat Ansible Automation Platform, but you do not need a trial or paid subscription to IBM watsonx Code Assistant. This means that you do not need to configure the API key or model ID when setting up a trial account. Using the trial account, you can create single-task and multitask recommendations, generate playbooks, and view playbook explanations.

Prerequisites

Procedure

  1. Open the VS Code application.
  2. From the VS Code activity bar, click the Ansible icon to open the left panel.
  3. Ensure that you have configured the Ansible VS Code extension to enable Red Hat Ansible Lightspeed. For the steps, see Configuring the Ansible VS Code extension.
  4. In the Ansible Lightspeed view, click Connect.
  5. Enter your Red Hat account username and password.
  6. In the Ansible Lightspeed view, click Start trial. The Ansible Lightspeed portal login page opens.
  7. On the Ansible Lightspeed Portal, select the checkbox to accept the IBM terms and conditions before proceeding.

    You can also select to receive notifications about Red Hat products, services, and events. You can unsubscribe anytime if you no longer wish to receive the marketing emails.

  8. Click Start trial. Your Red Hat Ansible Lightspeed trial has started.
  9. View the time remaining on your trial account:

    1. From the VS Code activity bar, click the Ansible icon.
    2. In the Ansible Lightspeed view, verify that you are logged in using your trial account and view the expiration date of your trial account.

As a Red Hat customer portal administrator, you must configure Red Hat Ansible Lightspeed to connect to your IBM watsonx Code Assistant instance. This chapter provides information about configuring both the Red Hat Ansible Lightspeed cloud service and on-premise deployment.

3.1. Configuration requirements

3.1.1. Licensing requirements

  • Red Hat Ansible Lightspeed cloud service

    To use the Red Hat Ansible Lightspeed cloud service, you must meet one of the following requirements:

    • Your organization has a trial or paid subscription to both the Red Hat Ansible Automation Platform and IBM watsonx Code Assistant.
    • Your organization has a trial or paid subscription to the Red Hat Ansible Automation Platform, and you have a Red Hat Ansible Lightspeed trial account.

      Note

      A Red Hat Ansible Lightspeed trial account does not require an IBM watsonx Code Assistant subscription.

  • Red Hat Ansible Lightspeed on-premise deployment

    To use an on-premise deployment of Red Hat Ansible Lightspeed, your organization must have the following subscriptions:

    • A trial or paid subscription to the Red Hat Ansible Automation Platform
    • An installation of IBM watsonx Code Assistant for Red Hat Ansible Lightspeed on Cloud Pak for Data

3.1.2. Setup requirements

To set up Red Hat Ansible Lightspeed for your organization, you need the following IBM watsonx Code Assistant information:

  • API key

    A unique API key authenticates all requests made from Red Hat Ansible Lightspeed to IBM watsonx Code Assistant. Each Red Hat organization with a valid Ansible Automation Platform subscription must have a configured API key. When an authenticated RH-SSO user creates a task request in Red Hat Ansible Lightspeed, the API key associated with the user’s Red Hat organization is used to authenticate the request to IBM watsonx Code Assistant.

  • Model ID

    A unique model ID identifies an IBM watsonx Code Assistant model in your IBM Cloud account. The model ID that you configure in the Ansible Lightspeed administrator portal is used as the default model, and can be accessed by all Ansible Lightspeed users within your organization.

Important

You must configure both the API key and the model ID when you are initially configuring Red Hat Ansible Lightspeed.

As a Red Hat customer portal administrator, you must configure Red Hat Ansible Lightspeed cloud service to connect to your IBM watsonx Code Assistant instance.

Note

The IBM Cloud service instance of IBM watsonx Code Assistant is available in the following data centers:

  • Dallas (us-south)
  • Frankfurt (eu-de)
  • Sydney (au-syd) (Essentials plan only)

Ansible Lightspeed cloud deployments are configured to connect exclusively to the US (Dallas) IBM data center. Attempts to connect from non-US data centers will result in connection failure. If you want to use a non-Dallas IBM data center, then you must set up Ansible Lightspeed in hybrid deployment model. For more information about IBM’s supported data centers, see the topic Setting up your watsonx Code Assistant for Red Hat Ansible Lightspeed service in IBM watsonx Code Assistant documentation.

Use the Ansible Lightspeed administrator portal to connect Red Hat Ansible Lightspeed to IBM watsonx Code Assistant.

Prerequisites

  • You have organization administrator privileges to a Red Hat Customer Portal organization with a valid Red Hat Ansible Automation Platform subscription.

Procedure

  1. Log in to the Ansible Lightspeed portal as an organization administrator.
  2. Click Log inLog in with Red Hat.
  3. Enter your Red Hat account username and password. The Ansible Lightspeed Service uses Red Hat Single Sign-On (RH-SSO) for authentication.

    As part of the authentication process, the Ansible Lightspeed Service checks whether your organization has an active Ansible Automation Platform subscription. On successful authentication, the login screen is displayed along with your username and your assigned user role.

  4. From the login screen, click Admin Portal.

    You are redirected to the Red Hat Ansible Lightspeed with IBM watsonx Code Assistant administrator portal where you can connect Red Hat Ansible Lightspeed to your IBM watsonx Code Assistant instance.

Use this procedure to configure the Red Hat Ansible Lightspeed cloud service.

Prerequisites

  • You have obtained an API key and a model ID from IBM watsonx Code Assistant that you want to use in Red Hat Ansible Lightspeed.

    For information about how to obtain an API key and model ID from IBM watsonx Code Assistant, see the IBM watsonx Code Assistant documentation.

Procedure

  1. Log in to the Ansible Lightspeed portal as an organization administrator.
  2. From the login screen, click Admin Portal.
  3. Specify the API key of your IBM watsonx Code Assistant instance:

    1. Under IBM Cloud API Key, click Add API key. A screen to enter the API Key is displayed.
    2. Enter the API Key.
    3. Optional: Click Test to validate the API key.
    4. Click Save.
  4. Specify the model ID of the model that you want to use:

    1. Click Model Settings.
    2. Under Model ID, click Add Model ID. A screen to enter the Model Id is displayed.
    3. Enter the Model ID that you obtained in the previous procedure as the default model for your organization.
    4. Optional: Click Test model ID to validate the model ID.
    5. Click Save.

      When the API key and model ID is successfully validated, Red Hat Ansible Lightspeed is connected to your IBM watsonx Code Assistant instance.

As an Red Hat Ansible Automation Platform administrator, you can set up a Red Hat Ansible Lightspeed on-premise deployment and connect it to an IBM watsonx Code Assistant instance. After the on-premise deployment is successful, you can start using the Ansible Lightspeed service with the Ansible Visual Studio (VS) Code extension.

Note
  • Red Hat Ansible Lightspeed on-premise deployments are supported on Red Hat Ansible Automation Platform version 2.4 and later.
  • The IBM Cloud service instance of IBM watsonx Code Assistant is available in the following data centers:

    • Dallas (us-south)
    • Frankfurt (eu-de)
    • Sydney (au-syd) (Essentials plan only)

Ansible Lightspeed cloud deployments are configured to connect exclusively to the US (Dallas) IBM data center. Attempts to connect from non-US data centers will result in connection failure. If you want to use a non-Dallas IBM data center, then you must set up Ansible Lightspeed in hybrid deployment model. For more information about IBM’s supported data centers, see the topic Setting up your watsonx Code Assistant for Red Hat Ansible Lightspeed service in IBM watsonx Code Assistant documentation.

3.3.1. Overview

This section provides information about the system requirements, prerequisites, and the process for setting up a Red Hat Ansible Lightspeed on-premise deployment.

3.3.1.1. Deployment models

You can use one of the following modes of deployment:

  • On-premise deployment

    Both Red Hat Ansible Lightspeed and the IBM watsonx Code Assistant model (IBM Cloud Pak for Data) are on-premise deployments. Telemetry data is not collected for an on-premise mode of deployment.

  • Hybrid deployment

    Red Hat Ansible Lightspeed is an on-premise deployment, while IBM watsonx Code Assistant model is a cloud deployment. Telemetry data is not collected for hybrid deployments.

    A hybrid deployment model provides the following benefits:

    • Enables you to set up an on-premise deployment of Red Hat Ansible Lightspeed, with IBM watsonx Code Assistant model on a cloud environment.
    • Provides the freedom and flexibility to choose an environment that best suits your organizational needs.
    • Enables organizations to use the Ansible Automation Platform for user authentication, instead of logging into the Red Hat cloud.
    • Enables organizations to deploy the Ansible Automation Platform in their preferred region.
3.3.1.2. System requirements

Your system must meet the following minimum system requirements to install and run the Red Hat Ansible Lightspeed on-premise deployment.

Expand
RequirementMinimum requirement

RAM

5 GB

CPU

1

Local disk

40 GB

To see the rest of the Red Hat Ansible Automation Platform system requirements, see the System requirements section of Planning your installation.

Note

You must also have installed IBM watsonx Code Assistant for Red Hat Ansible Lightspeed on Cloud Pak for Data. The installation includes a base model that you can use to set up your Red Hat Ansible Lightspeed on-premise deployment. For installation information, see the watsonx Code Assistant for Red Hat Ansible Lightspeed on Cloud Pak for Data documentation.

3.3.1.3. Prerequisites
  • You have installed Red Hat Ansible Automation Platform on your Red Hat OpenShift Container Platform environment.
  • You have administrator privileges for Red Hat Ansible Automation Platform.
  • You have installed IBM watsonx Code Assistant for Red Hat Ansible Lightspeed on Cloud Pak for Data.
  • Your system meets the minimum system requirements to set up Red Hat Ansible Lightspeed on-premise deployment.
  • You have obtained an API key and a model ID from IBM watsonx Code Assistant.

    For information about obtaining an API key and model ID from IBM watsonx Code Assistant, see the IBM watsonx Code Assistant documentation. For information about installing IBM watsonx Code Assistant for Red Hat Ansible Lightspeed on Cloud Pak for Data, see the watsonx Code Assistant for Red Hat Ansible Lightspeed on Cloud Pak for Data documentation.

  • You have an existing external PostgreSQL database configured for the Red Hat Ansible Automation Platform, or have a database created for you when configuring the Red Hat Ansible Lightspeed on-premise deployment.

Use this procedure to install the Ansible Automation Platform operator on the Red Hat OpenShift Container Platform.

Prerequisites

  • You have installed and configured automation controller.

Procedure

  1. Log in to the Red Hat OpenShift Container Platform as an administrator.
  2. Create a namespace:

    1. Go to AdministrationNamespaces.
    2. Click Create Namespace.
    3. Enter a unique name for the namespace.
    4. Click Create.
  3. Install the operator:

    1. Go to OperatorsOperatorHub.
    2. Select the namespace where you want to install the Red Hat Ansible Automation Platform operator.
    3. Search for the Ansible Automation Platform operator.
    4. From the search results, select the Ansible Automation Platform (provided by Red Hat) tile.
    5. Select an Update Channel. You can select either stable-2.x or stable-2.x-cluster-scoped as the channel.
    6. Select the destination namespace if you selected “stable-2.x” as the update channel.
    7. Select Install. It takes a few minutes for the operator to be installed.
  4. Click View Operator to see the details of your newly installed Red Hat Ansible Automation Platform operator.

3.3.3. Creating a model configuration secret

You must create a configuration secret to connect to an IBM watsonx Code Assistant model, which can be either an on-premise deployment or a cloud deployment.

Prerequisites

Procedure

  1. Go to the Red Hat OpenShift Container Platform.
  2. Select WorkloadsSecrets.
  3. Click CreateKey/value secret.
  4. From the Projects list, select the namespace that you created when you installed the Red Hat Ansible Automation Platform operator.
  5. Click CreateKey/value secret.
  6. In Secret name, enter a unique name for the secret. For example, model-aiconnect.
  7. Add the following keys and their associated values individually:

    Expand
    KeyValue

    username

    For on-premise deployment only

    Enter the username you use to connect to an IBM Cloud Pak for Data deployment.

    model_type

    Enter one of the following values per your IBM watsonx Code Assistant model:

    • For on-premise deployment (IBM Cloud Pak for Data): wca-onprem
    • For cloud deployment (IBM Cloud): wca

    model_url

    Enter the URL of the IBM watsonx Code Assistant model. For cloud deployment, the model URL could be https://api.dataplatform.cloud.ibm.com.

    model_api_key

    Enter the API key of your IBM watsonx Code Assistant model that was generated during the model installation.

    model_id

    Enter the ID of your IBM watsonx Code Assistant model.

    model_verify_ssl

    Optional, and supported on Ansible Automation Platform 2.5 and later

    This key controls whether the SSL certificate of the IBM watsonx Code Assistant model is verified.

    Default = true

    model_enable_anonymization

    Optional and supported on Ansible Automation Platform 2.5.250730 and later

    This key controls whether the anonymization of Personally Identifiable Information (PII) is enabled. PII information includes passwords, IP addresses, email addresses, and other sensitive data. When PII anonymization is enabled, users' personal information is modified to some generic values to protect their data and reduce the risk of data leaks.

    You can turn off the anonymization by specifying the value as false if you want to retain all original information as entered by users and improve the quality of the answers. If you set the value to false and the Ansible administrator is using Ansible Lightspeed in hybrid mode (where the model is in IBM watsonx Code Assistant in IBM Cloud) then their users' PII is sent to IBM Cloud.

    Default = true

    Important

    Ensure that you do not accidentally add any whitespace characters (extra line, space, and so on) to the value fields. If there are any extra or erroneous characters in the secret, the connection to IBM watsonx Code Assistant fails.

  8. Click Create.

    After you create the model configuration secret, you must update the YAML file of the Ansible Automation Platform operator.

After you create the model configuration secret, you must update the YAML file of the Ansible Automation Platform operator to use the secret.

Procedure

  1. Go to the Red Hat OpenShift Container Platform.
  2. Select OperatorsInstalled Operators.
  3. From the list of installed operators, select the Ansible Automation Platform operator.
  4. Locate and select the Ansible Automation Platform custom resource, and then click the required app.
  5. Select the YAML tab.
  6. Scroll the text to find the Lightspeed category, and add the following details under the spec: section:

    spec:
      lightspeed:
        disabled: false
        model_config_secret_name: <Name of the model configuration secret that you recently created.>
    Copy to Clipboard Toggle word wrap
  7. Click Save. The Ansible Lightspeed service takes a few minutes to set up.

To access the on-premise deployment of Red Hat Ansible Lightspeed, all Ansible users within your organization must install the Ansible Visual Studio (VS) Code extension in their VS Code editor, and configure the extension to connect to the on-premise deployment.

Prerequisites

  • You have installed VS Code version 1.70.1 or later.

Procedure

  1. Obtain the URL of your Ansible Lightspeed instance:

    1. In Red Hat OpenShift Container Platform, select NetworkingRoutes and locate the Red Hat Ansible Lightspeed instance that was created.
    2. From the Location column, copy the URL of your Ansible Lightspeed instance.

      The URL will be in the following format: https://<lightspeed_route>/complete/aap/

  2. Open the VS Code application.
  3. From the Activity bar, click the Extensions icon.
  4. From the Installed Extensions list, select Ansible.
  5. From the Ansible extension page, click the Settings icon ( Settings icon ) and select Extension Settings.
  6. Select Ansible Lightspeed settings and specify the following information:

    • In the URL for Ansible Lightspeed field, enter the Route URL of the Red Hat Ansible Lightspeed on-premise deployment. Ansible users must have Ansible Automation Platform controller credentials.
    • Optional: If you want to use a custom model instead of the default model, in the Model ID Override field, enter the custom model ID. Your settings are automatically saved in VS Code.

      After configuring Ansible VS Code extension to connect to Red Hat Ansible Lightspeed on-premise deployment, you must log in to Ansible Lightspeed through the Ansible VS Code extension.

      Note

      If your organization recently subscribed to the Red Hat Ansible Automation Platform, it might take a few hours for Red Hat Ansible Lightspeed to detect the new subscription. In VS Code, use the Refresh button in the Ansible extension from the Activity bar to check again.

After you have set up the Red Hat Ansible Lightspeed on-premise deployment successfully, you can modify the deployment if you want to connect to another IBM watsonx Code Assistant model. For example, you connected to the default IBM watsonx Code Assistant model but now want to connect to a custom model instead. To connect to another IBM watsonx Code Assistant model, you must create new connection secrets, and then update the connection secrets and parameters on an existing Ansible Automation Platform operator.

Prerequisites

  • You have set up a Red Hat Ansible Lightspeed on-premise deployment.
  • You have obtained an API key and a model ID of the IBM watsonx Code Assistant model you want to connect to.
  • You have created a new model configuration secret for the IBM watsonx Code Assistant model that you want to connect to. For information about creating a model configuration secrets, see Creating a model configuration secret.

Procedure

  1. Go to the Red Hat OpenShift Container Platform.
  2. Select OperatorsInstalled Operators.
  3. From the list of installed operators, select the Ansible Automation Platform operator.
  4. Locate and select the Ansible Automation Platform custom resource, and then click the required app.
  5. Select the YAML tab.
  6. Scroll the text to find the spec section under Lightspeed category. For example:

    spec:
      lightspeed:
        disabled: false
        model_config_secret_name: <Name of the model configuration secret that you recently created.>
    Copy to Clipboard Toggle word wrap
  7. Replace the model_config_secret_name value with the name of the IBM watsonx Code Assistant that you want to connect to.
  8. Click Save.

    The new Ansible Lightspeed pods are created. After the new pods are running successfully, the old Ansible Lightspeed pods are terminated.

After the Red Hat Ansible Lightspeed on-premise deployment is successful, use the following procedure to monitor the metrics on an API endpoint /metrics.

Procedure

  1. Create a system auditor user:

    1. Create a user with a system auditor role in the Red Hat Ansible Automation Platform. For the procedure, see the Creating a user section of Getting started with Ansible Automation Platform.
    2. Verify that you can log in to the Ansible Lightspeed portal for on-premise deployment (https://<lightspeed_route>/) as the newly-created system auditor user, and then log out.
  2. Create a token for the system auditor user:

    1. Log in to the Ansible Lightspeed portal for on-premise deployment (https://<lightspeed_route>/admin) as an administrator by using the following credentials:

      • Username: admin
      • Password: The secret that is named as <lightspeed-custom-resource-name>-admin-password in the Red Hat OpenShift Container Platform cluster namespace where Red Hat Ansible Lightspeed is deployed.
    2. On the Django administration window, select Users from the Users area. A list of users is displayed.
    3. Verify that the user with the system auditor role is listed in the Users list.
    4. From the Django Oauth toolkit area, select Access tokensAdd.
    5. Provide the following information and click Save:

      • User: Use the magnifying glass icon to search and select the user with the system auditor role.
      • Token: Specify a token for the user. Copy this token for later use.
      • Id token: Select the token ID.
      • Application: Select Ansible Lightspeed for VS Code.
      • Expires: Select the date and time when you want the token to expire.
      • Scope: Specify the scope as read write.

        An access token is created for the user with a system auditor role.

    6. Log out from the Ansible Lightspeed portal for on-premise deployment.
  3. Monitor your Red Hat Ansible Lightspeed on-premise deployment, by using the authorization token of the user with the system auditor role, to access the metrics endpoint https://<lightspeed_route>/metrics.

3.3.8. Using the Ansible Lightspeed REST API

As the platform administrator, you can configure and use the Ansible Lightspeed REST API to build a custom automation development and tooling workflow outside of VS Code. For information about the Ansible Lightspeed REST API, see Ansible AI Connect. 1.0.0 (v1) in the API catalog.

Note

The Ansible Lightspeed REST API is available for Ansible Automation Platform 2.5 and later.

Prerequisite

  • Ensure that you are using the Red Hat Ansible Automation Platform operator patch version 2.5-20250305.9 or later and Red Hat Ansible Lightspeed operator version 2.5.250225 or later.

Procedure

  1. Select the platform user for whom you want to grant REST API access.

    You can select an existing user or create a platform user in the Red Hat Ansible Automation Platform. For the procedure, see the Creating a user section of Getting started with Ansible Automation Platform.

  2. Verify that you can log in to the Ansible Lightspeed portal for on-premise deployment (https://<lightspeed_route>/) as the platform user you selected or created, and then log out.
  3. Create a token for the platform user:

    1. Log in to the Ansible Lightspeed portal for on-premise deployment (https://<lightspeed_route>/admin) as an administrator by using the following credentials:

      • Username: admin
      • Password: The secret that is named as <lightspeed-custom-resource-name>-admin-password in the Red Hat OpenShift Container Platform cluster namespace where Red Hat Ansible Lightspeed is deployed.
    2. On the Django administration window, select Users from the Users area. A list of users is displayed.
    3. Verify that the platform user is listed in the Users list.
    4. From the Django Oauth toolkit area, select Access tokensAdd.
    5. Provide the following information and click Save:

      • User: Use the magnifying glass icon to search and select the newly-created or existing user for whom you want to grant API access.
      • Token: Specify a token for the user. Copy this token for later use.
      • Id token: Select the token ID.
      • Application: Select Ansible Lightspeed for VS Code.
      • Expires: Select the date and time when you want the token to expire.
      • Scope: Specify the scope as read write.

        An access token is created for the user.

    6. Log out from the Ansible Lightspeed portal for on-premise deployment.
  4. Make a direct call to the Ansible Lightspeed REST API by specifying the newly-created token in the authorization header:

    curl -H "Authorization: Bearer <token>"
    https://<lightspeed_route>/api/v1/me/
    Copy to Clipboard Toggle word wrap

Chapter 4. Developing Ansible content

As an automation developer, you can use Red Hat Ansible Lightspeed to implement your organization’s automation strategy. Red Hat Ansible Lightspeed can help you create and use custom automation content. This chapter provides information about how to get set up as an automation developer on Red Hat Ansible Lightspeed, with details on how to:

  • Access the Ansible Lightspeed portal as an automation developer
  • Install and configure the VS Code
  • Create task recommendations
  • Create playbooks and view playbook explanations
  • Provide feedback on the Ansible Lightspeed service

You can access Red Hat Ansible Lightspeed through the Ansible Lightspeed portal. After you enter your Red Hat Single Sign-On (RH-SSO) account credentials, your account is authenticated and you are granted access. Your assigned user role is displayed on the login screen of the Ansible Lightspeed portal.

Expand
Table 4.1. User login scenarios
ScenarioResult

You are a RH-SSO user.

NOTE: This is the typical scenario for accessing Red Hat Ansible Lightspeed as an Ansible user.

You are routed to the Red Hat Ansible Lightspeed paid commercial offering.

You are a RH-SSO user, but your organization administrator has not configured Red Hat Ansible Lightspeed to connect with IBM watsonx Code Assistant.

You are routed to the Red Hat Ansible Lightspeed paid commercial offering with a message that your organization administrator has not configured a model for your organization.

Procedure

  1. Go to the Ansible Lightspeed portal login page.
  2. Click Log inLog in with Red Hat.
  3. Enter your Red Hat account username and password.

    On successful authentication, the login screen is displayed along with your username and your assigned user role.

To log out of the Ansible Lightspeed Service, you must log out of both the Ansible Lightspeed VS Code extension and the Ansible Lightspeed portal.

Procedure

  • Log out of the Ansible Lightspeed VS Code extension:

    • Click the Person icon Person icon . You will see a list of accounts that VS Code is logged into.
    • Select Ansible LightspeedSign Out.
  • Log out of the Ansible Lightspeed portal:

Red Hat Ansible Lightspeed with IBM watsonx Code Assistant is integrated with the Ansible Visual Studio (VS) Code extension in VS Code. The Ansible VS Code extension, with Red Hat Ansible Lightspeed features enabled, automatically collects recommendations, usage telemetry, and Ansible YAML file state through automated events.

To access Red Hat Ansible Lightspeed, all Ansible users must install and configure the Ansible VS Code extension in their VS Code. The Ansible VS Code extension uses the Ansible-specific IBM watsonx Granite model configured in the Red Hat Ansible Lightspeed administrator portal as the default mode for all users in your organization.

You can also use a custom, fine-tuned model if your organization administrator has created a custom model and has shared the model ID with you separately. Use the model-override setting in the Ansible VS Code extension to override the default model, and use the custom model instead. Using a custom model enables you to improve the code recommendation experience and tune the model to your organizational automation patterns. For example, if you are using Red Hat Ansible Lightspeed both as an organization administrator and a user, you can test the custom model for select Ansible users before making it available for all users in your organization. For more information, see Configuring custom models.

4.2.1. Connectivity requirements

To generate code recommendations, the Ansible Lightspeed service in Visual Studio (VS) Code editor requires access to the following outbound domain:

The outbound connections are encrypted on TCP protocol port 443.

4.2.2. Installing the Ansible VS Code extension

Prerequisites

  • VS Code version 1.70.1 or later.
Note

You can also install VScode derivatives, such as VScode Insider or VS Codium.

Procedure

  1. Open the VS Code application.
  2. From the navigation menu, click the Extensions icon.
  3. In the Search field, enter Ansible.
  4. Select Ansible to choose the Ansible language support extension published by Red Hat.
  5. Click Install.
  6. After installation is complete, verify your VSCode installation:

    1. Create a new YAML file using the .yml or .yaml file extension.
    2. From the Status toolbar, click the language indicator and select Ansible to associate the Ansible language type with the new YAML file.
    3. Start writing a test playbook. Contextual aids are displayed as you start creating your content.

4.2.3. Configuring the Ansible VS Code extension

You can configure the Ansible VS Code extension to enable Red Hat Ansible Lightspeed and specify it’s portal URL and IBM watsonx Code Assistant model ID.

Prerequisites

  • Your organization administrator has configured an IBM watsonx Code Assistant model for your organization.

Procedure

  1. Open the VS Code application.
  2. From the Activity bar, click the Extensions icon Extensions .
  3. From the Installed Extensions list, select Ansible.
  4. From the Ansible extension page, click the Settings icon and select Extension Settings.
  5. Select Ansible Lightspeed settings, and specify the following information:

    1. Ensure that the Enable Ansible Lightspeed with watsonx Code Assistant inline suggestions checkbox is selected.
    2. In the URL for Ansible Lightspeed field, verify that you have the following URL: https://c.ai.ansible.redhat.com/.
    3. Select the Enable Ansible Lightspeed with watsonx Code Assistant inline suggestions checkbox.
  6. Optional: If you want to use the custom model instead of the default model, in the Model ID Override field, enter the custom model ID. The model-override setting enables you to override the default model and use the custom model, after your organization administrator has created a custom model and has shared the model ID with you separately.

    Your settings are automatically saved in VS Code.

    The following illustration displays the configured settings for the Ansible VS Code extension:

    Figure 4.1. Configured settings for the Ansible VS Code extension

    Note

    If your organization recently subscribed to the Red Hat Ansible Automation Platform, it might take a few hours for Red Hat Ansible Lightspeed to detect the new subscription. In VS Code, use the Refresh button in the Ansible extension from the Activity bar to check again.

After installing and configuring the VS Code extension, you can log in to the Ansible Lightspeed service.

Red Hat Ansible Lightspeed provides different sign-in methods depending on whether you are using the cloud service or the on-premise deployment.

  • Ansible Lightspeed on-premise deployments

    Users are authenticated using your Red Hat Ansible Automation Platform login.

    To sign in, you can use the Connect button in the Ansible Lightspeed view, or the Sign in with Ansible Lightspeed to use Ansible option in the Accounts menu. Once prompted in the browser, select Log in with Ansible Automation Platform, and log in with the authorization mechanism that your automation controller is configured with.

  • Ansible Lightspeed cloud service

    Users are authenticated using Red Hat Single Sign-On (RH-SSO).

    To sign in from VS Code, you can use the Connect button in the Ansible Lightspeed view, or the Sign in with Ansible Lightspeed to use Ansible option in the Accounts menu. Follow the on-screen prompts to log in and access the Ansible Lightspeed service using your RH-SSO.

    Note

    If you are using a cloud development environment at a domain unknown by Ansible Lightspeed, such as on-premise Red Hat OpenShift Dev Spaces, your Accounts sign-in menu provides the option Sign-in with Red Hat to use Ansible. This option uses a device code flow to successfully complete the sign-in process and requires the Red Hat Authentication extension v0.2.0 or later. If you require this authentication flow but don’t see the Sign-in with Red Hat to use Ansible option, ensure you are using the Ansible VS Code extension v24.5.2 or later.

Procedure

  1. Open the VS Code application.
  2. Sign in using either the Connect button in the Ansible Lightspeed view or the Accounts menu.

    • Sign in using the Connect button:

      1. From the VS Code activity bar, click the Ansible icon.
      2. In the Ansible Lightspeed view, click Connect.
      3. Follow the on-screen prompts to sign in to Ansible Lightspeed.
    • Sign in using the Accounts menu:

      1. From the VS Code activity bar, click the Accounts menu.
      2. Sign in with Ansible Lightspeed to use Ansible or sign in with Red Hat to use Ansible, depending on the sign-in option you are presented with.

        Note
        • The sign-in options are displayed when the VS Code extension is in an active state. The extension is activated after you open the Ansible side panel or after you open an Ansible file in the VS Code editor. If you do not see this option, use the Connect button to link to the Ansible Lightspeed service.
        • If you are using a cloud development environment at a domain unknown by Ansible Lightspeed, such as on-premise Red Hat OpenShift Dev Spaces, your Accounts sign-in menu provides the option Sign-in with Red Hat to use Ansible. This option uses a device code flow to successfully complete the sign-in process and requires the Red Hat Authentication extension v0.2.0 or later. If you require this authentication flow but don’t see the Sign-in with Red Hat to use Ansible option, ensure you are using the Ansible VS Code extension v24.5.2 or later.
      3. Follow the on-screen prompts to sign in to Ansible Lightspeed.

    On successful authentication, the login screen is displayed along with your username and your assigned user role.

To log out of the Ansible Lightspeed Service, you must log out of both the Ansible Lightspeed VS Code extension and the Ansible Lightspeed portal.

Procedure

  • Log out of the Ansible Lightspeed VS Code extension:

    • Click the Person icon Person icon . You will see a list of accounts that VS Code is logged into.
    • Select Ansible LightspeedSign Out.
  • Log out of the Ansible Lightspeed portal:

4.3. Creating task recommendations

Red Hat Ansible Lightspeed is integrated into Visual Studio (VS) Code through the Ansible VS Code extension. You can request code recommendations for your task intent by using Ansible VS Code extension.

You can perform the following tasks from the Ansible VS Code extension:

  • Create single task or multitask requests by using natural language prompts

    • Create a single task prompt

      Write a description of your task in the - name: key of a new task line in your Ansible file. For example, to automate a task of installing PostgreSQL server, you can enter the prompt - name: Install postgresql-server.

    • Create a multitask prompt

      Place your cursor on a new line in your Ansible YAML file at the correct indentation, and start your prompt with a Pound key (#).

      Write the descriptions of your tasks, separating each prompt by using Ampersand symbols (&). For example, to automate a multitask of installing PostgreSQL server and running the initial PostgreSQL setup command, you can enter the prompt # Install postgresql-server & run postgresql-setup command.

      The Ansible Lightspeed service reads the text, interacts with the IBM watsonx Code Assistant model, and generates Ansible task recommendations based on your natural language prompt.

      Note

      Currently, Red Hat Ansible Lightspeed supports user prompts in English language only. However, there could be instances where the training data that was used to train the IBM watsonx Code Assistant models included non-English language. In such scenarios, the model can generate code recommendations for prompts made in the same non-English language, but the generated code recommendations might or might not be accurate.

  • View the content source matching results

    For each generated code recommendation, Red Hat Ansible Lightspeed lists content source matches, including details such as potential source, content author, and relevant licenses. You can use this data to gain insight into potential training data sources used to generate the code recommendations.

  • Provide feedback on the Ansible Lightspeed service

    The Ansible Lightspeed service learns your organizational patterns and improves the code recommendation experience over time. You can provide feedback on whether the generated code recommendations were suitable for your task intent. This feedback enables Red Hat Ansible Lightspeed with IBM watsonx Code Assistant to improve on the quality of its suggestions.

4.3.2. Creating single task recommendations

You can request code recommendations for a single task by entering natural language prompts in Ansible VS Code extension. For example, to automate a task of installing a PostgreSQL server, you can enter the prompt - name: Install postgresql-server. The Ansible Lightspeed service reads the text, interacts with the IBM watsonx Code Assistant model, and generates the code recommendations.

Prerequisites

  • You meet one of the following requirements:

    • Your organization has a trial or paid subscription to both the Red Hat Ansible Automation Platform and IBM watsonx Code Assistant.
    • Your organization has a trial or paid subscription to the Red Hat Ansible Automation Platform, and you have a Red Hat Ansible Lightspeed trial account.
  • You have installed and configured the Ansible VS Code extension.

Procedure

  1. Log in to VS Code with your Red Hat account.
  2. Create a new YAML file or use an existing YAML file:

    • Create a YAML file:

      1. Select FileNew Text File.
      2. From the lower right of the screen, click Plain Text, and in the language mode, select Ansible.
      3. Save the file as a YAML file format extension (.yml or .yaml).
    • Use an existing YAML file:

      1. On the bottom right of the screen, click the existing language mode, and in the language mode settings, select Ansible.

        Note

        If you do not see the language mode section in your VS Code editor, from the Command Palette, select Configure Language ModeAnsible.

  3. Verify that you see an entry for Lightspeed on the status bar at the lower right of VS Code.

    If Ansible is already selected as the desired language but the Lightspeed entry is not displayed, re-select Ansible as the language mode. The following illustration shows Lightspeed and Ansible entries on the VS Code status bar.

    Figure 4.2. Ansible and Lightspeed set as selected language mode

  4. Optional: If you see an error message about missing Ansible lint, you can install the missing module or disable it. Perform any one of the following tasks:

    • Install Ansible lint: For installation information, see the Installing section of the Ansible Lint documentation.
    • Disable Ansible lint:

      1. From the Activity bar, click the Extensions icon Extensions .
      2. From the Installed extensions list, select Ansible.
      3. From the Ansible extension page, click the Settings icon and select Extension Settings.
      4. Clear the Ansible › Validation › Lint: Enabled checkbox.
  5. Create a playbook or use an existing playbook.

    For more information, see the Getting started with playbooks guide.

  6. In the playbook, provide the following information to request code recommendations for a single task:

    1. Add a new Ansible task by starting a new line with - name: at the correct indentation.
    2. Add a detailed natural language prompt in the task description after - name: on the same line. For example, you can specify the following single task prompt: - name: Install postgresql-server
    3. Press Enter directly after the task description. Keep the cursor at the same location in your file, and wait for the code recommendation results to populate.

      The Ansible Lightspeed service is engaged, and it starts generating code recommendations for a single task.

      Important

      Ansible Lightspeed service takes around 5 seconds per task to populate the code recommendations. If you are using a multitask prompt, the Ansible Lightspeed service takes a bit longer (number of tasks times 5 seconds) to populate the results. Do not move your cursor or press any key while the code recommendation is being generated. If you change the cursor location or press any key, Ansible VS Code extension cancels the request and the Ansible Lightspeed service does not process your request.

      When the Ansible Lightspeed service is engaged, a Lightspeed processing status indicator is displayed in the lower right of the screen to denote that your code recommendation is being generated.

      Lightspeed icon

  7. View your code recommendations and ensure that the recommendations match your task intent.

    The following illustration shows the code recommendations generated by the Ansible Lightspeed service for the single task Install postgresql-server:

    Lightspeed single task in progress

  8. Accept or reject the code recommendations:

    • To accept a code recommendation, press Tab.
    • To reject a code recommendation, press Esc.

      Note

      If you reject a recommendation, you can modify the prompt and review the generated code recommendations once again to match your task intent.

  9. On the ANSIBLE: LIGHTSPEED TRAINING MATCHES tab, view the content source matching results.

    The following illustration shows the training matches found in existing Ansible Galaxy content for the task prompt Install postgresql-server:

  10. Click Save to save the code recommendation changes in your Ansible YAML file.

4.3.3. Creating multitask recommendations

You can request multitask code recommendations by entering a sequence of natural language task prompts in Ansible VS Code extension. In a YAML file, start your prompt with a pound symbol (#), and separate each prompt by using the ampersand symbol (&).

Example of a multitask prompt

# Install postgresql-server & run postgresql-setup command
Copy to Clipboard Toggle word wrap

For better readability, you can split your multitask inline prompts over multiple lines. To achieve this, end your current line with an ampersand symbol (&) and start the next line with the hash symbol (#).

Example of a multitask prompt split over multiple lines

# Create a keypair called lightspeed-keypair & create a vpc & create vpc_id var &
# create a security group that allows SSH & create subnet with 10.0.1.0/24 cidr &
# create an internet gateway & create a route table
Copy to Clipboard Toggle word wrap

The Ansible Lightspeed service reads the text, interacts with the IBM watsonx Code Assistant model, and generates the code recommendations.

Note

While entering a multitask prompt, the Ansible VS Code extension might display a warning if you have long lines in your prompt based on your ansible-lint settings. This warning is a minor readability error and does not impact the quality of your code recommendation output. To resolve the error, you can either ignore it or fix it by splitting your multitask inline prompt over multiple lines.

Prerequisites

  • You meet one of the following requirements:

    • Your organization has a trial or paid subscription to both the Red Hat Ansible Automation Platform and IBM watsonx Code Assistant.
    • Your organization has a trial or paid subscription to the Red Hat Ansible Automation Platform, and you have a Red Hat Ansible Lightspeed trial account.
  • You have installed and configured the Ansible VS Code extension.

Procedure

  1. Log in to VS Code with your Red Hat account.
  2. Create a new YAML file or use an existing YAML file.

    • Create a YAML file:

      1. Select FileNew Text File.
      2. From the lower right of the screen, click Plain Text, and in the language mode, select Ansible.
      3. Save the file as a YAML file format extension (.yml or .yaml).
    • Use an existing YAML file:

      1. On the bottom right of the screen, click the existing language mode, and in the language mode settings, select Ansible.

        Note

        If you do not see the language mode section in your VS Code editor, from the Command Palette, select Configure Language ModeAnsible.

  3. Verify that you see an entry for Lightspeed on the status bar at the lower right of VS Code.

    If Ansible is already selected as the desired language but the Lightspeed entry is not displayed, re-select Ansible as the language mode. The following illustration shows Lightspeed entry on the VS Code status bar.

    Figure 4.3. Ansible and Lightspeed set as selected language mode

  4. Optional: If you see an error message about missing Ansible lint, you can install the missing module or disable it. Perform any one of the following tasks:

    • Install Ansible lint: For installation information, see the Installing section of the Ansible Lint documentation.
    • Disable Ansible lint:

      1. From the Activity bar, click the Extensions icon Extensions .
      2. From the Installed extensions list, select Ansible.
      3. From the Ansible extension page, click the Settings icon and select Extension Settings.
      4. Clear the Ansible › Validation › Lint: Enabled checkbox.
  5. Create a playbook or use an existing playbook.

    For more information, see the Getting started with playbooks guide.

  6. In the playbook, provide the following information to request multitask code recommendations:

    1. Start a new YAML file comment by entering a pound symbol (#) at the correct indentation.
    2. Add a detailed natural language prompt in a sequence, separating each task by using the ampersand symbol (&).

      Example of a multitask prompt

      # Install postgresql-server & run postgresql-setup command
      Copy to Clipboard Toggle word wrap

      For better readability, split your multitask inline prompts over multiple lines. To achieve this, end your current line with an ampersand symbol (&) and start the next line with the hash symbol (#).

      Example of a multitask prompt split over multiple lines

      # Create a keypair called lightspeed-keypair & create a vpc & create vpc_id var &
      # create a security group that allows SSH & create subnet with 10.0.1.0/24 cidr &
      # create an internet gateway & create a route table
      Copy to Clipboard Toggle word wrap
    3. Press Enter directly after the task description. Keep the cursor at the same location in your file, and wait for the code recommendation results to populate.

      The Ansible Lightspeed service is engaged, and it starts generating code recommendations for multiple tasks.

      Important

      Ansible Lightspeed service takes around 5 seconds per task to populate the code recommendations. If you are using a multitask prompt, the Ansible Lightspeed service takes a bit longer (number of tasks times 5 seconds) to populate the results. Do not move your cursor or press any key while the code recommendation is being generated. If you change the cursor location or press any key, Ansible VS Code extension cancels the request and the Ansible Lightspeed service does not process your request.

      When the Ansible Lightspeed service is engaged, a Lightspeed processing status indicator is displayed in the lower right of the screen to denote that your code recommendation is being generated.

      Lightspeed icon

  7. Optional: If multitask code recommendations are not being generated, log out of VS Code and log in again using your Red Hat account.
  8. View your code recommendations and ensure that the recommendations match your task intent.

    The following illustration shows the code recommendations generated by the Ansible Lightspeed service for the multitask prompt Install postgresql-server & run postgresql-setup command: :

    Lightspeed single task in progress

  9. Accept or reject the code recommendations:

    • To accept a code recommendation, press Tab.
    • To reject a code recommendation, press Esc.

      Note

      If you reject a recommendation, you can modify the prompt and review the generated code recommendations once again to match your task intent.

  10. On the ANSIBLE: LIGHTSPEED TRAINING MATCHES tab, view the content source matching results.

    The following illustration shows the training matches found in existing Ansible Galaxy content for the task prompt multitask prompt Install postgresql-server & run postgresql-setup command:

  11. Click Save to save the code recommendation changes in your Ansible YAML file.

The Red Hat Ansible Lightspeed with IBM watsonx Code Assistant machine learning model is trained on the following content:

  • Existing public or private Git repositories
  • Content from Ansible Galaxy

Owing to IBM watsonx Code Assistant’s generative AI technology, as well as the types of Ansible content that were used to train the model, it is not possible to identify the specific set of training data that contributed to the generated code recommendations. However, Ansible Lightspeed provides a capability that helps you to understand the possible origins of generated code recommendations.

For each generated code recommendation, Red Hat Ansible Lightspeed lists the content source matches, including details such as potential source, content author, and relevant licenses. You can use this data to gain insight into potential training data sources used to generate the code recommendations.

After you enter a natural language prompt in VS Code and see the generated code recommendations, you can view the content source matches on the ANSIBLE: LIGHTSPEED TRAINING MATCHES tab.

For example, the following illustration shows the training matches for the multitask recommendation Install postgresql-server & run postgresql-setup command:

Figure 4.4. Training matches for a multitask recommendation

This capability enables you to find out the open source license terms that are associated with related training data. However, it is unlikely that either the training data used in fine-tuning the code or the output recommendations themselves are protected by copyright, or that the output reproduces training data that is controlled by copyright licensing terms.

Note

Red Hat does not claim any copyright or other intellectual property rights in the suggestions generated by Red Hat Ansible Lightspeed with IBM watsonx Code Assistant.

Using the Ansible VS Code extension, you can create Ansible playbooks using a natural language interface in English. Red Hat Ansible Lightspeed with IBM watsonx Code Assistant reads the natural language prompts and generates an entire playbook recommendation based on your intent. You can also view the explanations for new or existing playbooks. The playbook explanations describe what the playbook does and contextualize its impact.

These capabilities enable Ansible developers to use natural language prompts to create new Ansible playbooks quickly and more efficiently and also get an explanation for existing Ansible playbook, thereby reducing the overall onboarding learning period. For information about Ansible playbooks, see the Getting started with Ansible Playbooks guide.

Note

You can create playbooks and view playbook explanations when connecting to the Red Hat Ansible Lightspeed cloud service and on-premise deployments.

4.4.1. Best practices to create playbooks

Follow these guidelines for the highest quality of a playbook recommendation.

  • Ensure that the goal statements directly specify what the playbook must do.

    Your statement should start with the goal of the playbook, for example, Apply security patches to RHEL9. Avoid starting statements with Create a playbook that, Please prepare a playbook that, or I need help with.

  • Ensure that the goal statement does not contain new lines.
  • Ensure that the goal statement is not more than one sentence.

    You might have to repeat the details in the goal statement to produce the best results. It is recommended that you use the generated outline as feedback about whether your goal statement might benefit from more or less details, and then modify the goal statement as necessary.

  • Ensure the following when you edit the outline:

    • Do not restate the goal of the playbook.
    • Verify that the steps considered capture the key steps in the playbook. The steps need not reflect each and every task that is expected in the playbook.
    • Keep the step description in one sentence without adding new lines to the outline.

4.4.2. Generating Ansible playbooks

You can use the natural language interface in the Ansible VS Code extension to generate an entire Ansible playbook.

Prerequisites

  • You meet one of the following requirements:

    • Your organization has a trial or paid subscription to both the Red Hat Ansible Automation Platform and IBM watsonx Code Assistant.
    • Your organization has a trial or paid subscription to the Red Hat Ansible Automation Platform, and you have a Red Hat Ansible Lightspeed trial account.
  • You have installed and configured the Ansible VS Code extension.

Procedure

  1. Log in to VS Code with your Red Hat account.
  2. From the Activity bar, click the Ansible icon.
  3. Under Ansible Creator, click Get started. The Ansible Content Creator page is displayed.

    The following illustration displays the Ansible Content Creator page:

    Figure 4.5. Settings to create Ansible playbooks

  4. Select the Playbook with Ansible Lightspeed tile. The Create a playbook page is displayed.
  5. In the What do you want the playbook to accomplish? field, enter the prompts to create a playbook and click Analyze.

    After a few seconds, the recommended steps for your playbook intent are displayed in the Review the suggested steps for your playbook and modify as needed field.

  6. Perform one of the following tasks:

    • If the steps match your intent: Click Generate Playbook.
    • If any modifications are required: Click the editor and update the tasks or steps to suit your intent.
    • If the task suggestions do not match your intent: Click Back to change the original prompt and start over.
    • If you want to restore the original task suggestions: Click Reset and proceed to the next step.
  7. After you verify the steps, click Generate playbook.

    It takes a few seconds for the playbook to generate, and The following playbook was generated for you field displays the newly generated playbook.

  8. Click Open editor. The generated playbook opens as an untitled YAML file in the VS Code editor.
  9. Save the untitled YAML file.

4.4.3. Viewing the playbook explanations

You can request explanations for a newly created playbook as well as an existing Ansible playbook.

Prerequisites

  • You meet one of the following requirements:

    • Your organization has a trial or paid subscription to both the Red Hat Ansible Automation Platform and IBM watsonx Code Assistant.
    • Your organization has a trial or paid subscription to the Red Hat Ansible Automation Platform, and you have a Red Hat Ansible Lightspeed trial account.
  • You have installed and configured the Ansible VS Code extension.
  • You have opened the playbook whose explanation you want to view.

Procedure

  1. Log in to VS Code with your Red Hat account.
  2. Open an Ansible playbook YAML file in VS Code.
  3. Use one of the following methods to view the playbook explanation:

    • From an active playbook YAML file:

      1. Place your cursor anywhere within the playbook file.
      2. Right-click and select Explain the playbook with Ansible Lightspeed.
    • From the Ansible panel:

      1. From the navigation menu, click the Ansible icon.
      2. Select Explain the current playbook.

        The playbook explanation is displayed on the right panel of the VS Code screen.

        The following illustration shows an example of a playbook explanation:

        Figure 4.6. Example of a playbook explanation

4.5. Creating roles and viewing role explanations

You can create roles within Ansible collections using the Ansible VS Code extension. To create roles, use the Ansible VS Code extension, select the Role Generation option, and then enter the natural language prompts in English language. Red Hat Ansible Lightspeed reads the natural language prompts and creates a role recommendation based on your intent. You can also view the explanations for new or existing roles. The role explanations describe what the role does and contextualize its impact.

These capabilities enable Ansible developers to use natural language prompts to create Ansible roles quickly and more efficiently, as well as get an explanation for existing Ansible roles. In addition to generating playbooks, role generation can now further reduce your team’s overall onboarding learning period. For information about Ansible roles, see Bundle content with Ansible roles in the Getting started with Ansible Automation Platform guide.

Note

You can create roles and view role explanations when connecting to the Red Hat Ansible Lightspeed cloud service only.

4.5.1. Creating roles within collections

You can use the natural language interface in the Ansible VS Code extension to create one or more roles within an Ansible collection.

Prerequisites

  • You meet one of the following requirements:

    • Your organization has a trial or paid subscription to both the Red Hat Ansible Automation Platform and IBM watsonx Code Assistant.
    • Your organization has a trial or paid subscription to the Red Hat Ansible Automation Platform, and you have a Red Hat Ansible Lightspeed trial account.
  • You have installed and configured the Ansible VS Code extension v25.3.0 or later. For the procedure, see Installing and configuring the Ansible VS Code extension.
  • You have an existing Ansible environment configured with a valid collection directory within the Ansible VS Code extension.

Procedure

  1. Log in to VS Code with your Red Hat account.
  2. From the Activity bar, click the Ansible icon.
  3. Use one of the following methods to create a role:

    • From the Ansible panel:

      1. From the navigation menu, click the Ansible icon.
      2. Click Generate a role.
    • From the Command Palette:
    • From the Command Palette of the VS Code editor, click ViewCommand Palette, and then enter > Ansible Lightspeed: Role generation.

      The Create a role with Ansible Lightspeed page is displayed on the right panel of the VS Code screen.

  4. From the Select the collection to create role in list, choose the collection where you want to create the role. You must have a collection inside your workspace to create a role.

    If you do not have a collection, you must create it by using one of the following methods:

    • By using the following command:

      ansible-creator init collection myns.mycollection my_directory

      After you run the command, open the new directory with VS Code.

    • By using the Ansible VS Code extension

      For more information, see the topic About content collections in the Getting started with Ansible Automation Platform guide.

  5. In the Describe what you want to achieve in natural language field, enter the prompts to create a role and then click Analyze.

    After a few seconds, the recommended steps for your role intent are displayed in the Review the suggested steps for your role and modify as needed field.

  6. Perform the following tasks:

    1. Review and optionally change the role name.
    2. Review the collection where the role will be created.
    3. Verify that the suggested steps match your intent and then click Continue.

      It takes a few seconds for the role to generate, and the newly generated role is displayed along with the list of files where the role was generated.

      Note
      • If you want to modify the steps: Click the editor field, update the prompts or steps to suit your intent, and then click Continue.
      • If the role suggestions do not match your intent: Click Back to change the original prompt and start over.
      • If you want to restore to the original suggested steps: Click Reset and then click Continue to proceed to the next step.
  7. Click Save files. A list of files is displayed that includes the new role.
  8. Click the files to open them in the VS Code editor directly.

4.5.2. Viewing the role explanations

You can request explanations for a newly created role as well as an existing Ansible role.

Prerequisites

  • You meet one of the following requirements:

    • Your organization has a trial or paid subscription to both the Red Hat Ansible Automation Platform and IBM watsonx Code Assistant.
    • Your organization has a trial or paid subscription to the Red Hat Ansible Automation Platform, and you have a Red Hat Ansible Lightspeed trial account.
  • You have installed and configured the Ansible VS Code extension v25.3.0 or later. For the procedure, see Installing and configuring the Ansible VS Code extension.
  • You have opened the role whose explanation you want to view in the VS Code editor.

Procedure

  1. Log in to VS Code with your Red Hat account.
  2. Open an Ansible role YAML file within the roles directory in VS Code.
  3. Use one of the following methods to view the playbook explanation:

    • From an active role YAML file:

      1. Place your cursor anywhere within the playbook file.
      2. Right-click and select Explain the role with Ansible Lightspeed.
    • From the Ansible panel:

      1. From the navigation menu, click the Ansible icon.
      2. Select Explain the current playbook.
    • From the Command Palette:

      • From the Command Palette of the VS Code editor, enter Explain the role with Ansible Lightspeed.

        The role explanation is displayed on the right panel of the VS Code screen.

        The following illustration shows an example of a role explanation:

        Figure 4.7. Example of a role explanation

4.6. Viewing the audit logs

The Ansible Visual Studio (VS Code) extension now records all Red Hat Ansible Lightspeed operations in an audit log for future use. Each interaction is recorded with a timestamp, the type of action performed, details of the requested task, and other relevant information. The logs are displayed in the Ansible Lightspeed Output Channel of the VS Code editor and are available until you close VS Code.

Procedure

  1. Open VS Code.
  2. Open the Command Palette of the VS Code editor.
  3. Click OutputShow Output Channels, and then select Ansible Lightspeed.

    An Output panel is displayed at the bottom of the VS Code editor with a log of all user actions.

    Following is an example of an audit log:

    Figure 4.8. Audit log

Red Hat Ansible Lightspeed with IBM watsonx Code Assistant is designed to be improved through feedback on the quality of its suggestions. The technical details of user experiences with Red Hat Ansible Lightspeed are useful in informing further improvements.

You can submit feedback through the following channels:

  • From the Ansible VS Code extension: Use this method to provide feedback about the quality of the suggested code recommendations.

    Important

    Red Hat Support cannot assist with the suggestion quality reports. Content quality issues are routed to IBM for resolution.

  • From the Red Hat customer portal: Use this method to log bug reports and service disruption incidents, and feature requests.

Prerequisites

Ensure that you meet one of the following requirements:

  • Your organization has a trial or paid subscription to both the Red Hat Ansible Automation Platform and IBM watsonx Code Assistant.
  • Your organization has a trial or paid subscription to the Red Hat Ansible Automation Platform, and you have a Red Hat Ansible Lightspeed trial account.

Procedure

  1. Open Visual Studio Code.
  2. Click the Lightspeed entry in your status bar to see options.
  3. In the Tell us why field, provide your feedback. Here, provide feedback about what results you were expecting to receive, compared to what results were generated and the training match.
  4. Select the issue type: Bug report, Feature request, or Suggestion feedback.

    Note

    To raise a bug or feature request, contact Red Hat Support and open a support ticket. Bug features and feature requests made through Ansible Lightspeed feedback are not tracked through the Red Hat Service Level Agreement (SLA).

  5. Select the I understand that feedback is shared with Red Hat and IBM checkbox.
  6. Click Send.

    The following image shows an example of providing suggestion feedback:

    Figure 4.9. Providing feedback on Ansible Lightspeed

As an organization administrator, you can use Red Hat Ansible Lightspeed to manage the Ansible Lightspeed service, so that your users and teams can create and use custom automation content. This chapter provides information about how to get set up as an organization administrator on Red Hat Ansible Lightspeed, with details on how to:

  • Access the Ansible Lightspeed portal as an organization administrator
  • View and manage the Admin dashboard telemetry data
  • Configure custom models
Note

If you are using a free 90-day trial account, you need a trial or paid subscription to the Red Hat Ansible Automation Platform, but you do not need a trial or paid subscription to IBM watsonx Code Assistant. This means that you do not need to configure the API key or model ID when setting up or using a trial account.

Use the Ansible Lightspeed administrator portal to connect Red Hat Ansible Lightspeed to IBM watsonx Code Assistant.

Prerequisites

  • You have organization administrator privileges to a Red Hat Customer Portal organization with a valid Red Hat Ansible Automation Platform subscription.

Procedure

  1. Log in to the Ansible Lightspeed portal as an organization administrator.
  2. Click Log inLog in with Red Hat.
  3. Enter your Red Hat account username and password. The Ansible Lightspeed Service uses Red Hat Single Sign-On (RH-SSO) for authentication.

    As part of the authentication process, the Ansible Lightspeed Service checks whether your organization has an active Ansible Automation Platform subscription. On successful authentication, the login screen is displayed along with your username and your assigned user role.

  4. From the login screen, click Admin Portal.

    You are redirected to the Red Hat Ansible Lightspeed with IBM watsonx Code Assistant administrator portal where you can connect Red Hat Ansible Lightspeed to your IBM watsonx Code Assistant instance.

To log out of the Ansible Lightspeed Service, you must log out of both the Ansible Lightspeed VS Code extension and the Ansible Lightspeed portal.

Procedure

  • Log out of the Ansible Lightspeed VS Code extension:

    • Click the Person icon Person icon . You will see a list of accounts that VS Code is logged into.
    • Select Ansible LightspeedSign Out.
  • Log out of the Ansible Lightspeed portal:

Red Hat Ansible Lightspeed collects the following telemetry data by default:

  • Operational telemetry data

    This is the data that is required to operate and troubleshoot the Ansible Lightspeed service. For more information, refer the Enterprise Agreement. You cannot disable the collection of operational telemetry data.

    This includes the following data:

    • Organization you are logged into (Organization ID, account number)
    • Large language model (or models) that you are connected to
  • Admin dashboard telemetry data

    This is the data that provides insight into how your organization users are using the Ansible Lightspeed service, and the metrics are displayed on the Admin dashboard.

    This includes the following data:

    • Prompts and content suggestions, including accept or reject of the content suggestions
    • User sentiment feedback

      You can also disable the Admin dashboard telemetry if you no longer want to collect and monitor the telemetry data.

Note

Viewing telemetry data on the Admin dashboard is not yet supported on Red Hat Ansible Lightspeed on-premise deployments.

5.2.1. Prerequisites

To view and manage the Admin dashboard telemetry data, ensure that you have the following:

  • You have organization administrator privileges to a Red Hat Customer Portal organization with a valid Red Hat Ansible Automation Platform subscription.
  • You have installed the Ansible VS Code extension v2.13.148 that is required to collect Admin dashboard telemetry.
Important

Red Hat Ansible Lightspeed does not collect users' personal information, such as usernames or passwords. If any personal information is inadvertently received, the data is deleted. For more information about Red Hat Ansible Lightspeed’s privacy practices, see the Telemetry Data Collection Notice for the Admin dashboard.

5.2.2. What telemetry data is collected?

Following is the list of telemetry data that Red Hat Ansible Lightspeed collects:

  • Details of the organization that you are logged into, such as organization ID and account number
  • Large language models that you are connected to
  • Inline suggestions that were accepted, rejected, or ignored by your organization users
  • User sentiment feedback
  • Top 10 modules returned in code recommendations

5.2.3. Viewing the Admin dashboard telemetry

The Admin dashboard displays the analytics telemetry data that you can use to gain insight into how your organization users are using the Ansible Lightspeed service.

The Admin dashboard displays the following charts:

  • Inline suggestions accepted, rejected, or ignored by users

    This graph tracks the number of inline suggestions that were accepted, rejected, or ignored by users in your organization. Use this graph to gain insight into how your organization users are using the Ansible Lightspeed service.

  • User sentiment

    This graph measures the users' feedback (feelings, opinions). Use this graph to gain insight into the overall user experience with Red Hat Ansible Lightspeed.

  • Top 10 modules returned in code recommendations

    This graph displays the top 10 modules returned in code recommendations. Use this metric to determine which modules are being suggested the most to your organization’s automation developers.

Procedure

  1. Log in to the Ansible Lightspeed with IBM watsonx Code Assistant Hybrid Cloud Console as an organization administrator.
  2. From the navigation panel, select Ansible Lightspeed > Admin Dashboard.

    The Admin dashboard displays a graphical representation of analytics telemetry data for the last 30 days by default.

  3. Use the following filters to refine your telemetry data:

    • To view the telemetry data for a specific time period or for a custom date range, select the date range from the Quick Date Range list.
    • To view the telemetry data for a specific IBM watsonx Code Assistant model only, select the model ID from the Model Name list. By default, the Admin dashboard displays telemetry data for all models.

5.2.4. Disabling the Admin dashboard telemetry

Red Hat Ansible Lightspeed collects the Admin dashboard telemetry data by default. The data provides insight into how your organization users are using the Ansible Lightspeed service. If you no longer want to collect analytics telemetry data for your organization, you can disable the Admin dashboard telemetry.

After you disable the Admin dashboard telemetry, the Ansible Lightspeed service no longer collects the analytics telemetry data for your organization. The earlier telemetry data is still available on the Admin dashboard, but no latest data is displayed. If you re-enable the Admin dashboard telemetry, the Ansible Lightspeed service starts collecting data for your organization, and the metrics are displayed on the Admin dashboard after 24 hours.

Prerequisites

  • You have organization administrator privileges to a Red Hat Customer Portal organization with a valid Red Hat Ansible Automation Platform subscription.

Procedure

  1. Log in to the Ansible Lightspeed portal as an organization administrator.
  2. From the login screen, click Admin Portal.
  3. Under Admin Portal, click Telemetry.
  4. To disable the Admin dashboard telemetry, select Operational telemetry data only.

    Note

    To re-enable the Admin dashboard telemetry, select Admin dashboard telemetry data.

  5. Click Save.

5.3. Configuring custom models

As an organization administrator, you can create and use fine-tuned, custom models that are trained on your organization’s existing Ansible content. With this capability, you can tune the models to your organization’s automation patterns and improve the code recommendation experience.

After you create a custom model, you can specify one of the following access types:

  • Enable access for all users in your organization

    You can configure the custom model as the default model for your organization. All users in your organization can use the custom model.

  • Enable access for select Ansible users in your organization

    Using the model-override setting in the Ansible VS Code extension, select Ansible users can tune their Ansible Lightspeed service to use a custom model instead of the default model.

5.3.1. Process for configuring custom models

To configure a custom model, perform the following tasks:

Use the content parser tool, a command-line interface (CLI) tool, to scan your existing Ansible files and generate a custom model training data set. The training data set includes a list of Ansible files and their paths relative to the project root. You can then upload this data set to IBM watsonx Code Assistant, and use it to create a custom model that is trained on your organization’s existing Ansible content.

5.3.2.1. Methods of creating training data sets

You can generate a training data set by using one of the following methods:

  • With ansible-lint preprocessing

    By default, the content parser tool generates training data sets by using ansible-lint preprocessing. The content parser tool uses ansible-lint rules to scan your Ansible files and ensure that the content adheres to Ansible best practices. If rule violations are found, the content parser tool excludes these files from the generated output. In such scenarios, you must resolve the rule violations, and run the content parser tool once again so that the generated output includes all your Ansible files.

  • Without ansible-lint preprocessing

    You can generate a training data set without ansible-lint preprocessing. In this method, the content parser tool does not scan your Ansible files for ansible-lint rule violations; therefore, the training data set includes all files. Although the training data set includes all files, it might not adhere to Ansible best practices and could affect the quality of your code recommendation experience.

5.3.2.2. Supported data sources

The content parser tool scans the following directories and file formats:

  • Local directories
  • Archived files, such as .zip, .tar, .tar.gz, .tar.bz2, and .tar.xz files
  • Git repository URLs (includes both private and public repositories)
5.3.2.3. Process of creating a training data set

To create a custom model training data set, perform the following tasks:

  1. Install the content parser tool on your computer
  2. Generate a custom model training data set
  3. View the generated training data set
  4. (Optional: If you generated a training data set with ansible-lint preprocessing and detected ansible-lint rule violations) Resolve ansible-lint rule violations
  5. (Optional: If you generated multiple training data sets) Merge multiple training data sets into a single JSONL file
5.3.2.4. Installing the content parser tool

Install the content parser tool, a command-line interface (CLI) tool, on your computer.

Prerequisites

Ensure that your computer has one of the following supported OS:

  • Python version 3.10 or later.
  • UNIX OS, such as Linux or Mac OS.

    Note

    Installation of the content parser tool on Microsoft Windows OS is not supported.

Procedure

  1. Create a working directory and set up venv Python virtual environment:

    $ python -m venv ./venv

    $ source ./venv/bin/activate

  2. Install the latest version of the content parser tool from the pip repository:

    $ pip install --upgrade pip

    $ pip install --upgrade ansible-content-parser

  3. Perform one of the following tasks:

    • To generate a training data set without ansible-lint preprocessing, see section Generating a custom model training data set.
    • To generate a training data set with ansible-lint preprocessing, ensure that you have the latest version of ansible-lint installed on your computer:

      1. View the ansible-lint versions that are installed on your computer.

        $ ansible-content-parser --version

        $ ansible-lint --version

        A list of application versions and their dependencies are displayed.

      2. In the output, verify that the version of ansible-lint that was installed with the content parser tool is the same as that of the previously-installed ansible-lint. A mismatch in the installed ansible-lint versions causes inconsistent results from the content parser tool and ansible-lint.

        For example, in the following output, the content parser tool installation includes ansible-lint version 6.20.0 which is a mismatch from previously-installed ansible-lint version 6.13.1:

        $ ansible-content-parser --version
        ansible-content-parser 0.0.1 using ansible-lint:6.20.0 ansible-core:2.15.4
        $ ansible-lint --version
        ansible-lint 6.13.1 using ansible 2.15.4
        A new release of ansible-lint is available: 6.13.1 → 6.20.0
        Copy to Clipboard Toggle word wrap
      3. If there is a mismatch in the ansible-lint versions, deactivate and reactivate venv Python virtual environment:

        $ deactivate

        $ source ./venv/bin/activate

      4. Verify that the version of ansible-lint that is installed with the content parser tool is the same as that of the previously-installed ansible-lint:

        $ ansible-content-parser --version

        $ ansible-lint --version

        For example, the following output shows that both ansible-lint installations on your computer are of version 6.20.0:

        $ ansible-content-parser --version
        ansible-content-parser 0.0.1 using ansible-lint:6.20.0 ansible-core:2.15.4
        $ ansible-lint --version
        ansible-lint 6.20.0 using ansible-core:2.15.4
        ansible-compat:4.1.10 ruamel-yaml:0.17.32 ruamel-yaml-clib:0.2.7
        Copy to Clipboard Toggle word wrap

After installing the content parser tool, run it to scan your custom Ansible files and generate a custom model training data set. You can then upload the training data set to IBM watsonx Code Assistant and create a custom model for your organization. If you used ansible-lint preprocessing and encountered rule violations, you must resolve the rule violations before uploading the training data set to IBM watsonx Code Assistant.

You can generate a training data set by using one of the following methods:

  • With ansible-lint preprocessing

    By default, the content parser tool generates training data sets by using ansible-lint preprocessing. The content parser tool uses ansible-lint rules to scan your Ansible files and ensure that the content adheres to Ansible best practices. If rule violations are found, the content parser tool excludes these files from the generated output. In such scenarios, you must resolve the rule violations, and run the content parser tool once again so that the generated output includes all your Ansible files.

  • Without ansible-lint preprocessing

    You can generate a training data set without ansible-lint preprocessing. In this method, the content parser tool does not scan your Ansible files for ansible-lint rule violations; therefore, the training data set includes all files. Although the training data set includes all files, it might not adhere to Ansible best practices and could affect the quality of your code recommendation experience.

Prerequisites

  • You must have installed the content parser tool on your computer.
  • You must have verified that the version of ansible-lint that is installed with the content parser tool is the same as that of the previously-installed ansible-lint.

Procedure

  1. Run the content parser tool to generate a training data set:

    • With ansible-lint preprocessing: $ ansible-content-parser source output
    • Without ansible-lint preprocessing: $ ansible-content-parser source output -S

      The following table lists the required parameters.

      Expand
      ParameterDescription

      source

      Specifies the source of the training data set.

      output

      Specifies the output of the training data set.

      -S or --skip-ansible-lint

      Specifies to skip ansible-lint preprocessing while generating the training data set.

    For example: If the source is a Github URL https://github.com/ansible/ansible-tower-samples.git, and the output directory is /tmp/out, the command prompt is $ ansible-content-parser https://github.com/ansible/ansible-tower-samples.git /tmp/out.

  2. Optional: To generate a training data set with additional information, specify the following parameters while running the content parser tool.

    Expand
    ParameterDescription

    --source-license

    Specifies to include the licensing information of the source directory in the training data set.

    --source-description

    Specifies to include the descriptions of the source directory in the training data set.

    --repo-name

    Specifies to include the repository name in the training data set. If you do not specify the repository name, the content parser tool automatically generates it from the source name.

    --repo-url

    Specifies to include the repository URL in the training data set. If you do not specify the repository URL, the content parser tool automatically generates it from the source URL.

    -v or --verbose

    Displays the console logging information.

    Example of a command prompt for Github repository ansible-tower-samples

    $ ansible-content-parser --profile min \
    --source-license undefined \
    --source-description Samples \
    --repo-name ansible-tower-samples \
    --repo-url 'https://github.com/ansible/ansible-tower-samples' \
    git@github.com:ansible/ansible-tower-samples.git /var/tmp/out_dir
    Copy to Clipboard Toggle word wrap

    Example of a generated training data set for Github repository ansible-tower-samples

    The training data set is formatted with Jeff Goldblum (jg), a command-line JSON processing tool.

    $ cat out_dir/ftdata.jsonl| jq
    {
    "data_source_description": "Samples",
    "input": "---\n- name: Hello World Sample\n hosts: all\n tasks:\n - name: Hello Message",
    "license": "undefined",
    "module": "debug",
    "output": " debug:\n msg: Hello World!",
    "path": "hello_world.yml",
    "repo_name": "ansible-tower-samples",
    "repo_url": "https://github.com/ansible/ansible-tower-samples"
    }
    Copy to Clipboard Toggle word wrap
5.3.2.6. Viewing the generated training data set

After the content parser tool scans your Ansible files, it generates the training data set in an output directory. The training data set includes a ftdata.jsonl file, which is the main output of the content parser tool. The file is available in JSON Lines file format, where each line entry represents a JSON object. You must upload this JSONL file to IBM watsonx Code Assistant to create a custom model.

Result

The generated output directory has the following file structure:

output/
  |-- ftdata.jsonl  # Training dataset
  |-- report.txt   # A human-readable report
  |
  |-- repository/
  |     |-- (files copied from the source repository)
  |
  |-- metadata/
        |-- (metadata files generated during the execution)
Copy to Clipboard Toggle word wrap

Where:

  • ftdata.jsonl: A training data set file, which is the main output of the content parser tool. The file is available in JSON Lines files format, where each line entry represents a JSON object. You must upload this JSONL file in IBM watsonx Code Assistant to create a custom model.
  • report.txt: A human-readable text file that provides a summary of all content parser tool executions.
  • repository: A directory that contains files from the source repository. Sometimes, ansible-lint updates the directory according to the configured rules, so the file contents of the output directory might differ from the source repository.
  • metadata: A directory that contains multiple metadata files that are generated during each content parser tool execution.

Next steps

You can use the report.txt file to resolve ansible-lint rule violations. The report.txt file contains the following information:

  • File counts per type: A list of files according to their file types, such as playbooks, tasks, handlers, and jinja2.
  • List of Ansible files that were identified: A list of files identified by ansible-lint with a file name, a file type, and whether the file was excluded from further processing, or automatically fixed by ansible-lint.
  • List of Ansible modules found in tasks: A list of modules identified by ansible-lint with a module name, a module type, and whether the file was excluded from further processing, or automatically fixed by ansible-lint.
  • Issues found by ansible-lint: A list of issues along with a brief summary of ansible-lint execution results. If ansible-lint encounters files with syntax-check errors in the first execution, then it initiates a second execution and excludes the files with errors from the scan. You can use this information to resolve ansible-lint rule violations.
5.3.2.7. About ansible-lint rule violations

By default, the content parser tool uses ansible-lint rules to scan your Ansible files and ensure that the content adheres to Ansible best practices. If rule violations are found, the content parser tool excludes these files from the generated output. In such scenarios, it is recommended that you fix the files with rule violations before uploading the training data set to IBM watsonx Code Assistant.

By default, ansible-lint applies the rules that are configured in ansible-lint/src/ansiblelint/rules while scanning your Ansible files. For more information about ansible-lint rules, see the Ansible Lint documentation.

  • Using autofixes

    The content parser tool runs ansible-lint with the --fix=all option to perform autofixes, which can fix or simplify fixing issues identified by that rule.

    If ansible-lint identifies rule violations that have an associated autofix, it automatically fixes or simplifies the issues that violate the rules. If ansible-lint identifies rule violations that do not have an associated autofix, it reports these instances as rule violations which you must fix manually. For more information about autofixes, see Autofix in Ansible Lint Documentation.

  • Using syntax-checks

    Ansible-lint also performs syntax checks while scanning your Ansible files. If any syntax-check errors are found, ansible-lint stops processing the files. For more information about syntax-check errors, see syntax-check in Ansible Lint Documentation.

    The content parser tool handles syntax-check rule violations in the following manner:

    • If syntax-check errors are found in the first execution of ansible-lint, the content parser tool generates a list of files that contain the rule violations.
    • If one or more syntax-check errors are found in the first execution of ansible-lint, the content parser tool runs ansible-lint again but excludes the files with syntax-check errors. After the scan is completed, the content parser tool generates a list of files that contain rule violations. The list includes all files that caused syntax-check errors as well as other rule violations. The content parser tool excludes files with rule violations in all future scans, and the final training data set does not include data from the excluded files.
5.3.2.8. Resolving ansible-lint rule violations

If the content parser tool finds ansible-lint rule violations in your Ansible files, it is recommended that you fix the files with rule violations before uploading the training data set to IBM watsonx Code Assistant. If you do not resolve the rule violations, the content parser tool excludes these files from the generated output.

Procedure

  • Use one of the following methods to resolve ansible-lint rule violations:

    • Run the content parser tool with the --no-exclude option

      If any rule violations, including syntax-check errors, are found, the execution is aborted with an error and no training data set is created.

    • Limit the set of rules that ansible-lint uses to scan your data with the --profile option

      It is recommended that you fix the files with rule violations. However, if you do not want to modify the source files, you can limit the set of rules that ansible-lint uses to scan your data. To limit the set of rules that ansible-lint uses to scan your data, specify the --profile option with a predefined profile (for example, min, basic, moderate, safety, shared, or production profiles) or by using ansible-lint configuration files. For more information, see the Ansible Lint documentation.

    • Run the content parser tool by skipping ansible-lint preprocessing

      You can run the content parser without ansible-lint preprocessing. The content parser tool generates a training data set without scanning for ansible-lint rule violations.

      To run the content parser tool without ansible-lint preprocessing, execute the following command:

      $ ansible-content-parser source output -S

      Where:

      • source: Specifies the source of the training data set.
      • output: Specifies the output of the training data set.
      • -S or --skip-ansible-lint: Specifies to skip ansible-lint preprocessing while generating the training data set.

For every execution, the content parser tool creates a training data set JSONL file named ftdata.jsonl that you upload to IBM watsonx Code Assistant for creating a custom model. If the content parser tool runs multiple times, multiple JSONL files are created. IBM watsonx Code Assistant supports a single JSONL file upload only; therefore, if you have multiple JSONL files, you must merge them into a single, concatenated file. You can also merge the multiple JSONL files that are generated in multiple subdirectories within a parent directory into a single file.

Procedure

  1. Using the command prompt, go to the parent directory.
  2. Run the following command to create a single, concatenated file:

    find . -name ftdata.json | xargs cat > concatenated.json

  3. Optional: Rename the concatenated file for easy identification.

    You can now upload the merged JSONL file to IBM watsonx Code Assistant and create a custom model.

After the content parser tool generates a custom model training data set, upload the JSONL file ftdata.jsonl to IBM watsonx Code Assistant and create a custom model for your organization.

Important

IBM watsonx Code Assistant might take a few hours to create a custom model, depending on the size of your training data set. You must continue monitoring the IBM Tuning Studio for the status of custom model creation.

For information about how to create and deploy a custom model in IBM watsonx Code Assistant, see the IBM watsonx Code Assistant documentation.

After you create and deploy a custom model in IBM watsonx Code Assistant, you must configure Red Hat Ansible Lightspeed so that you can use the custom model for your organization.

You can specify one of the following configurations for using the custom model:

  • Enable access for all users in your organization

    You can configure a custom model as the default model for your organization. All users in your organization can use the custom model.

  • Enable access for select Ansible users in your organization

    Using the model-override setting in the Ansible VS Code extension, select Ansible users can tune their Ansible Lightspeed service to use a custom model instead of the default model. For example, If you are using Red Hat Ansible Lightspeed as both an organization administrator and an end user, you can test the custom model for select Ansible users before making it available for all users in your organization.

Procedure

  • Choose one of the following configurations for your custom model:

    • Configure the custom model for all Ansible users in your organization

      1. Log in to the Ansible Lightspeed with IBM watsonx Code Assistant Hybrid Cloud Console as an organization administrator.
      2. Specify the model ID of the custom model:

        1. Click Model Settings.
        2. Under Model ID, click Add Model ID. A screen to enter the Model ID is displayed.
        3. Enter the Model ID of the custom model.
        4. Optional: Click Test model ID to validate the model ID.
        5. Click Save.
    • Configure the custom model for select Ansible users in your organization

      1. Log in to the VS Code application using your Red Hat account.
      2. From the Activity bar, click the Extensions icon Extensions .
      3. From the Installed Extensions list, select Ansible.
      4. From the Ansible extension page, click the Settings icon and select Extension Settings.
      5. From the list of settings, select Ansible Lightspeed.
      6. In the Model ID Override field, enter the model ID of the custom model.

        Your settings are automatically saved in VS Code, and you can now use the custom model.

The Ansible code bot scans existing content collections, roles, and playbooks hosted in GitHub repositories, and proactively creates pull requests whenever best practices or quality improvement recommendations are available.

Ansible code bot scans your code repositories to recommend code quality improvements. It promotes Ansible best practices while avoiding common errors that can lead to bugs or make code harder to maintain. The bot automatically submits pull requests to the repository, which proactively alerts the repository owner to a recommended change to their content. You can configure Ansible code bot to scan your existing Git repositories (both public and private).

Note

Your organization must have an active subscription to Red Hat Ansible Automation Platform to use the Ansible code bot. However, IBM watsonx Code Assistant is not required to use the Ansible code bot.

After the Ansible code bot is installed, it automatically scans the selected repositories that are in Jinja format. Once the scanning is complete, the code bot generates an initial PR for each repository; the initial PR also contains the scan schedule configured to run weekly. You must review the initial PR for the suggested changes and merge the PR. Once the initial PR is merged, the scan schedule is triggered, and the subsequent repository scans are performed weekly. If required, you can change the scan schedule to a daily or monthly cadence.

You can access the Ansible code bot dashboard that displays all your repositories that have the bot installed along with their scan status. From the dashboard, you can start a manual scan, view the scan history, and view the repository. From GitHub, you can configure a schedule to scan your repository at regular intervals, and add or remove a repository from being scanned. For more information, see Managing repository scans.

Important

Ansible code bot is supported on the following GitHub versions:

  • GitHub.com
  • GitHub Enterprise Cloud

    Ansible code bot is not supported on GitHub Enterprise Server. For more information, see GitHub’s plans in the GitHub documentation.

The following examples are code recommendations that the Ansible code bot can suggest:

  • Available alternatives for deprecated legacy syntax or implementation patterns
  • Module version changes and updates, such as:

    • Adding any new required parameters
    • Flagging deprecated parameters
    • Removing unused parameters
  • Applying YAML best practices
  • Adding comment blocks
  • Fixing casing issues in name fields

6.1. Installing the Ansible code bot

Install the Ansible code bot to get code recommendations for your repositories, and then log in to the Ansible code bot dashboard to monitor and manage your repository scans.

Procedure

  1. Log in to GitHub by using the account associated with your organization.
  2. Go to the Ansible code bot GitHub app.
  3. Select the Ansible repositories that you want the app to access:

    • All repositories: Provides access to read the metadata of all repositories.
    • Only select repositories: Provides access to read the metadata of only the repositories that you select.
  4. Optional: If you selected Only select repositories in the previous step, select the repositories that you want the Ansible code bot to access from the Select repositories list.
  5. Click Install & Authorize. A message is displayed that specifies the following permissions are granted automatically to the bot during installation:

    • Read access to metadata
    • Read and write access to code and pull requests
  6. When prompted, log in to your Red Hat Single Sign-On account as an organization administrator.
  7. Log in to the Ansible code bot dashboard:

    1. On the Authorize Ansible code bot page, verify your account and repository permissions.
    2. Click Authorize Ansible.

      From the Authorize Ansible code bot page, the following actions occur:

      • Ansible code bot verifies that you are a part of an organization that has an active subscription to Red Hat Ansible Automation Platform.
      • GitHub requests read permissions to access the repositories associated with your account.

        On successful authorization, you are logged in to Ansible code bot dashboard. The dashboard displays all your repositories that have the Ansible code bot installed along with their scan status.

Verification

After the Ansible code bot is installed, it automatically scans the selected repositories that are in Jinja format. When the scanning is complete, the code bot generates an initial PR for each repository; the initial PR also contains the scan schedule configured to run weekly.

Perform the following tasks:

  1. Review the initial PR for the suggested changes, and merge the PR.

    After you merge the initial PR, the configured scan schedule is triggered, and the subsequent repository scans are performed weekly.

    Note

    If you do not merge the initial PR, the weekly scan schedule is not triggered and the Ansible code bot dashboard displays the repositories without any associated scan history.

    The following illustration is an example of an initial PR being created:

  2. Optional: If required, you can manually scan your repositories or change the scan schedule to a daily or monthly cadence.
  3. Modify scanned repositories by adding repositories or removing existing repositories from being scanned.

6.2. Uninstalling the Ansible code bot

If you no longer want to use the Ansible code bot, you can uninstall it from GitHub. After the code bot is uninstalled, you can still access the Ansible code bot dashboard but you cannot see the repositories on the dashboard or scan your repositories.

Procedure

  1. Log in to GitHub by using the account associated with your organization.
  2. In GitHub, click your profile photo > Settings.
  3. Under Integrations, click Applications > Installed GitHub Apps.
  4. Click Configure beside the Ansible code bot app.
  5. Under the Danger zone area, click Uninstall.

    The Ansible code bot app is uninstalled from your GitHub account.

6.3. Managing repository scans

The Ansible code bot dashboard displays a list of your repositories where the code bot is installed, and indicates if the scan schedule is not set, or is set to manual or scheduled scan.

You can scan your Git repository by starting a manual scan, or configure a schedule to scan your repository at regular intervals. After the scan is completed, you can view the scan history (start time, status, type of scan, link to the pull request if it was created, and the log message if the scan failed). You can also add new repositories for scanning or remove existing repositories from being scanned.

6.3.1. Manually scanning your Git repositories

You can manually scan your Git repositories if you did not set up a scanning schedule for your Ansible code bot or if you do not want to wait for the next scheduled scan. If you manually scan your repository, and no pull request was created, it is likely so because a duplicate pull request already exists. You can scan your repository from both the Ansible code bot dashboard and GitHub.

You can manually scan your Git repositories if you did not set up a scanning schedule for your Ansible code bot or if you do not want to wait for the next scheduled scan.

Procedure

  1. Log in to the Ansible code bot dashboard.

    The Repositories list displays a list of repositories that you selected for scanning.

    Note

    If you do not see your repository in the Repositories list, you can add it for scanning. For more information, see Adding or removing repositories from the Ansible code bot.

  2. To start a manual scan of your repository, click the Ellipsis icon ( Ellipsis icon ) beside the repository that you want to scan and select Scan now.
  3. Click Refresh to view the status of the scan job.
  4. To view more details about your repository scans, click the Ellipsis icon ( Ellipsis icon ) beside the repository and select View scan history.

    The repository’s scan history is displayed along with the scan start time, scan status, type of scan (scheduled or manual), link to the pull request if it was created, and the log message if the scan failed.

  5. To view your repository on GitHub, click the Ellipsis icon ( Ellipsis icon ) beside the repository and select View repository.

You can manually scan your Git repositories from GitHub if you did not set up a scanning schedule for your Ansible code bot or if you do not want to wait for the next scheduled scan.

Procedure

  1. In GitHub, go to the main page of the repository that you want to scan.
  2. To modify the repository settings, click the Settings icon beside the About area.
  3. In the Topics field, enter the keyword topic ansible-code-bot-scan to the repository.

    The following illustration shows the keyword topic for starting a manual scan:

  4. Click Save changes.

    Based on the repository webhook event, Ansible code bot starts a manual scan of your repository. If the avoid duplicate pull requests condition is not met, then the manual scan results in a new pull request with all the necessary Ansible code bot recommendations.

After installing the Ansible code bot, it automatically scans the selected repositories that are in Jinja format. Once the scanning is complete, the code bot generates an initial PR for each repository; the initial PR also contains the scan schedule configured to run weekly. You must review the initial PR for the suggested changes and merge the PR. Once the initial PR is merged, the scan schedule is triggered, and the subsequent repository scans are performed weekly. If required, you can change the scan schedule to a daily or monthly cadence.

Note

If you do not merge the initial PR, the weekly scan schedule is not triggered and the Ansible code bot dashboard displays the repositories without any associated scan history. In such a scenario, you must manually create a configuration file ansible-code-bot.yml and specify your scan schedule within the file.

You can specify one of following interval cadence to scan your Git repositories:

  • Daily: Runs every day from Monday to Sunday.
  • Weekly: Runs once a week on Monday. Per the initial configuration PR, the Ansible code bot is set to scan your repositories weekly until you change the schedule to daily or monthly.
  • Monthly: Runs on the first day of the month, once each month.

For each interval cadence, Ansible code bot starts scanning your Git repositories at 9 AM UTC.

Procedure

  1. In GitHub, navigate to the repository that you want to scan.
  2. Create a .yml configuration file named ansible-code-bot.yml in your repository .github folder. For example, .github/ansible-code-bot.yml.
  3. In the configuration file, specify the scan schedule in the interval parameter. You can specify the interval parameter as daily, weekly, or monthly. For example:

    schedule:
      interval: daily
    Copy to Clipboard Toggle word wrap
  4. Commit your changes.

    The Ansible code bot starts scanning your repository per the schedule you configured at 9 AM UTC time.

6.3.3. Viewing your repository’s scan history

Use the Ansible code bot dashboard to see a list of your repositories and their scan history.

Procedure

  1. Log in to the Ansible code bot dashboard.

    The Ansible code bot dashboard displays a list of your repositories where the code bot is installed, and indicates if the scan schedule is not set, or is set to manual or scheduled scan.

  2. To view the history of your repository’s scans, click the Ellipsis icon ( Ellipsis icon ) beside the repository and select View scan history.

    The repository’s scan history is displayed along with the scan start time, scan status, type of scan (scheduled or manual), link to the pull request if it was created, and the log message if the scan failed.

  3. To view your repository on GitHub, click the Ellipsis icon ( Ellipsis icon ) beside the repository and select View repository.

You can enable the Ansible code bot for a repository, or remove repositories that you no longer want to manage.

Procedure

  1. Log in to the Ansible code bot dashboard.
  2. Click Manage Code Bot on GitHub.
  3. In GitHub, click your profile photo > Settings.
  4. Under Integrations, click Applications.
  5. From the Repository access area, perform one of the following tasks:

    • Add a new repository: From the Select repositories list, select the repository that you want to add. The newly-added repository is displayed on the Ansible code bot dashboard.
    • Remove an existing repository: From the Select repositories list, click the Cross icon beside the repository that you want to delete. The deleted repository details are no longer visible on the Ansible code bot dashboard.
  6. Click Save.
  • If Ansible code bot has created a pull request on the latest commit default branch, it does not scan the repository. The bot skips scanning the repository because the pull request was committed on the latest default branch, and no new commit was made after that pull request.
  • If there is an existing pull request that is not on the latest commit default branch, the Ansible code bot does a pull request difference to compare the changes in both branches. The following scenarios are possible:

    • There is no difference in the existing and new scan results: Ansible code bot does not push the scan results as a new pull request.
    • There are differences found in the existing and the new scan results: the Ansible code bot creates a new pull request. The newly-created pull request does not close the existing pull request, against which the pull request difference was noted. This behavior makes it easier for the repository administrator to review only the latest pull request created by the Ansible code bot, and the administrator can avoid reviewing the older pull requests created by the bot. If required, the administrator can close the older pull requests.

Chapter 7. Troubleshooting

This section contains information to help you diagnose and resolve issues with using Red Hat Ansible Lightspeed with IBM watsonx Code Assistant.

This section provides information about errors when configuring the Red Hat Ansible Lightspeed and their workarounds.

The Ansible Lightspeed administrator portal can be accessed by the Red Hat organization administrator only.

If you are the Red Hat organization administrator, before you access the Ansible Lightspeed administrator portal, ensure that:

  • You have a valid Ansible Automation Platform subscription.

7.1.2. Cannot save the API key

When you enter the IBM watsonx Code Assistant API key, authentication fails and shows the following error message:

IBM Cloud API key is invalid

Red Hat Ansible Lightspeed verifies the API key by generating an associated access token. To resolve the error, ensure that you have not accidentally included any extra spaces when obtaining the API key from IBM watsonx Code Assistant. If you still cannot upload the API key, contact IBM Support.

When you enter the model ID in the Red Hat Ansible Lightspeed administrator portal, the authentication fails.

To resolve the error, ensure that:

  • You have configured a valid API key before you upload the model ID.
  • You have not accidentally included any extra spaces when entering the model ID.

While validating the model ID, Red Hat Ansible Lightspeed performs a test inference. If Red Hat Ansible Lightspeed detects an error, the validation fails and an Inference failed message is displayed.

To resolve the error, ensure that:

  • You have a valid API key and model ID.
  • You have not accidentally included any extra spaces when obtaining the API key and model ID from IBM watsonx Code Assistant.

After you configure a Red Hat Ansible Lightspeed on-premise deployment and try to log in to the Ansible Lightspeed portal, the log-in attempt fails. The following scenarios are possible:

  • The log-in attempt fails with the following error message:

    Error: invalid_request

    Mismatching redirect URL

    This error indicates an incorrect configuration of the login redirect URI. The redirect URI parameter must contain the URL of the Red Hat Ansible Lightspeed instance along with /complete/aap/ suffix. The following is an example of the login redirect URI:

    https://lightspeed-on-prem-web-service.com/complete/aap/

  • The log-in attempt fails with the following error message:

    Error: invalid_request

    Invalid client_id parameter value

    This error indicates that the authorization connection secret contains an incorrect client ID value. To resolve this error, ensure that you have not accidentally added any whitespace characters (extra line, space, and so on) to the auth_api_key parameter in the authorization connection secret. For more information, see Creating connection secrets.

  • The log-in attempt fails with the following error message:

    ERROR: Your credentials aren’t allowed

    You currently do not have access to.

    This error indicates that the authorization connection secret contains an incorrect client secret value. To resolve this error, ensure that you have not accidentally added any whitespace characters (extra line, space, and so on) to the auth_api_secret parameter in the authorization connection secret. For more information, see Creating connection secrets.

  • The log-in attempt fails with the following error message:

    Not Found

    The requested resource could not be found.

    This error indicates that an incorrect API URL value was used to create an authorization connection secret. To resolve this error, ensure that the auth_api_url parameter contains the prefix https:// and suffix /api/. For more information, see Creating connection secrets.

  • The log-in attempt fails with the following error message:

    Server Not Found

    This error indicates that the API URL value in the authorization connection secret does not contain the suffix /api/. To resolve this error, ensure that the auth_api_url parameter contains the suffix /api/. For more information, see Creating connection secrets.

  • The log-in attempt fails with the following error message:

    Server Error (500)

    This error message indicates the service has internal errors or that the authorization connection secret contains incorrect API URL value. To resolve this error, ensure that the auth_api_url parameter contains the prefix https:// and not http://. For more information, see Creating connection secrets.

  • The log-in attempt fails with the following error message:

    Bad Request (400)

    To resolve this error, check the auth_allowed_hosts parameter in the authorization secret. For test diagnosis, use the asterisk (*) sign. For more information, see Creating connection secrets.

After you log out from the Ansible Lightspeed portal, you are redirected to the automation controller API page instead of Ansible Lightspeed.

This error indicates that the logout redirect URI was not configured while setting up your Red Hat Ansible Lightspeed on-premise deployment. You must configure the logout redirect URI by adding the LOGOUT_ALLOWED_HOSTS entry to the YAML file.

The following scenarios are possible:

  • The log-in attempt fails with the following error message:

    Enable lightspeed services from settings to use the feature.

    This error indicates that Ansible Lightspeed is not enabled in the Ansible VS Code extension. To resolve this error, perform the following tasks:

    1. Open the VS Code application.
    2. From the Activity bar, click the Extensions icon.
    3. From the Installed Extensions list, select Ansible.
    4. From the Ansible extension page, click the Settings icon ( Settings icon ) and select Extension Settings.
    5. Select Ansible Lightspeed settings and then select the Enable Ansible Lightspeed checkbox.
  • You are redirected to an incorrect Ansible Lightspeed instance on clicking the Connect button.

    This error indicates an incorrect route URL was used while configuring the Ansible Lightspeed service in Ansible VS Code extension. Ensure that you have configured the correct value in the route URL without any suffix. For more information, see Configuring Ansible VS Code extension for Red Hat Ansible Lightspeed on-premise deployment.

  • Cannot request code recommendations

    The following error message is displayed:

    An error occurred attempting to complete your request. Please try again later.

    This error indicates that the Ansible Lightspeed service is not running or is running with issues. Please check the Lightspeed service logs (the pod with suffix -api) for more details and error codes.

  • Cannot request code recommendations

    The following error message is displayed:

    The IBM watsonx Code Assistant is unavailable. Please try again later.

    or:

    IBM watsonx Code Assistant Model ID is invalid. Please contact your administrator.

    This error indicates that the model secret contains incorrect values. To resolve this error, ensure that you have not accidentally added any whitespace characters (extra line, space, and so on) to the username, model_url, and model_api_key parameters in the model connection secret. For more information, see Creating connection secrets.

If you are using self-signed certificates on the model server, you might encounter SSL certification verification errors, causing the connection between Ansible Lightspeed service and the model server to fail. The following error message is displayed:

Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED]
certificate verify failed: self signed certificate in certificate chain (_ssl.c:1006)'))
Copy to Clipboard Toggle word wrap

To resolve this error, use one of the following workarounds based on your Ansible Automation Platform version:

  • For Red Hat Ansible Automation Platform 2.5 and later:

Specify the optional key/value pair as model_verify_ssl=true in the model secret to connect to an IBM watsonx Code Assistant model. For details about the procedure, see Creating connection secrets.

  • For Red Hat Ansible Automation Platform 2.4:

You can disable the SSL protection between the model server and the Ansible Lightspeed service. For example, you can disable the SSL protection when you are on a testing environment. To disable the SSL protection, you must add the following extra setting in the Red Hat Ansible Lightspeed Custom Resource Definition (CRD) YAML file under the spec: section:

extra_settings:
    - setting: ANSIBLE_AI_MODEL_MESH_API_VERIFY_SSL
      value: false
Copy to Clipboard Toggle word wrap
Important

Reenabling the SSL protection You must re-enable the SSL protection when deploying on a production environment. To re-enable the SSL protection, simply remove the extra setting from the YAML file.

To reenable the SSL protection, perform the following tasks: . Go to the Red Hat OpenShift Container Platform. . Select OperatorsInstalled Operators. . From the Projects list, select the namespace that you created when you installed the Red Hat Ansible Automation Platform operator. . Locate and select the Ansible Automation Platform operator. . Locate and select the Ansible Automation Platform custom resource, and then click the required app. . Select the YAML tab. The editor switches to a YAML editor view. . Scroll and find the spec: section, and add the following parameter under the spec: section:

+

extra_settings:
    - setting: ANSIBLE_AI_MODEL_MESH_API_VERIFY_SSL
      value: false
Copy to Clipboard Toggle word wrap
  1. Click Save.
  2. Restart the automation controller pods to apply the revised YAML.

    Perform the following steps: .. From the Red Hat OpenShift Container Platform, select WorkloadsPods. .. Locate and select the Ansible Lightspeed pod that you updated. .. Click the Edit icon beside the pod and select Delete Pod.

    + The select pod gets deleted and a new pod gets created.

The following scenarios are possible:

  • You receive a 403 error message.

    To resolve this error, ensure that:

    • Your organization administrator has configured Red Hat Ansible Lightspeed for your organization.
    • You meet one of the following requirements:

      • Your organization has a trial or paid subscription to both the Red Hat Ansible Automation Platform and IBM watsonx Code Assistant.
      • Your organization has a trial or paid subscription to the Red Hat Ansible Automation Platform, and you have a Red Hat Ansible Lightspeed trial account.
  • You have not configured the required Ansible VS code extension settings.

  • You receive a Failure on completion requests error when you make inference requests in VS Code.

    If you are part of an organization that has a trial or paid subscription to both Ansible Automation Platform and IBM watsonx Code Assistant, but your organization administrator has not configured an IBM watsonx Code Assistant model for your organization, you will encounter a Failure on completion requests error when you make inference requests in VS Code.

  • You receive an Ansible Lightspeed encountered an error. Try again after some time. error message when you make single-task or multitask requests.

    This error occurs when you use a remote SSH extension with VS Code to request single or multitask recommendations in playbooks. However, the task recommendations are generated when using a role. This error occurs in workspaces that contain a large number of roles.

  • Your VS Code Workspace settings override user settings.

    If your Workspace settings are configured, they can override our user settings even if you have configured the Ansible VS Code extension correctly. The Workspace settings can disable your VS Code extension settings, and therefore you cannot access the Ansible Lightspeed service.

    To resolve this error, ensure that there are no Workspace settings configured in VS Code. For more information, see Workspace settings in the VS Code documentation.

  • You entered a multitask prompt, but code recommendations were not generated.

    To resolve this error, log out of VS Code and log in again using your Red Hat account.

  • You clicked a different location or switched to a different window; therefore, the populated code recommendations disappeared.

    The Red Hat Ansible Lightspeed service could take multiple seconds per task to populate the code recommendations. If you are using a multitask prompt, the Red Hat Ansible Lightspeed service takes a bit longer to populate the results. Do not move your cursor or press any key while the code recommendation is being generated. If you change the cursor location or press any key, the Ansible VS Code extension cancels the request and the Red Hat Ansible Lightspeed service does not process your request. In this scenario, you must get the cursor back to its original position and repopulate the results.

The following error message is displayed: Your trial to the generative AI model has expired. Refer to your IBM Cloud Account to re-enable access to the IBM watsonx Code Assistant.

To resolve this error, refer to your IBM Cloud account and select an upgrade option.

You might encounter errors when connecting with to the Ansible VS code extension through a proxy. Connections to the outbound domain https://c.ai.ansible.redhat.com fail and a network error message is displayed.

To resolve this issue, you must add the URL https://c.ai.ansible.redhat.com/ in VS Code proxy settings. If you are using Red Hat Single Sign-On (RH-SSO) to authenticate users, then you must also grant access to https://sso.redhat.com in VS code proxy settings.

To modify the proxy settings in VS code, perform the following tasks:

  1. Open Visual Studio Code.
  2. Navigate to File > Preferences > Settings.
  3. Select ApplicationProxy in the sidebar.
  4. In the Http: Proxy field, add the following URLs to the proxy:

    • https://c.ai.ansible.redhat.com/
    • https://sso.redhat.com, if you are using RH-SSO to authenticate users.
  5. In the http: Proxy Support drop down list, select Override.
  6. Search for and select the following configuration keys:

    • Electron Fetch
    • System Certificates V2 if you are using your own Certificate Authority (CA).

For information about how to set up proxy support in VS Code, see Proxy server support in VS Code documentation and Proxy settings and fallback in The Chromium Project documentation.

If you encounter network issues, use the Network Proxy Test extension to test the connection:

  1. Install the VS code extension Network Proxy Test.
  2. Use the Network Proxy Test: Test Connection action to target the server and the endpoint using the parameter /check/status end-point.

    For example:

    https://c.ai.ansible.redhat.com/check/status/ to test the connection to Red Hat Ansible Lightspeed cloud service.

7.4. Troubleshooting Ansible code bot errors

7.4.1. Cannot access Ansible code bot

After you install Ansible code bot and attempt to log in, you receive the following error message:

Your organization does not have a valid Red Hat Ansible Lightspeed subscription

After you install Ansible code bot, you are redirected to a page that shows an active subscription status, as shown in the following image:

Figure 7.1. Ansible code bot login screen with an active subscription

If the login screen displays an inactive subscription status, Ansible code bot does not scan your Git repositories. The error occurs because your organization does not have a valid Ansible Automation Platform subscription. To resolve this error, ensure that you are part of an organization that has a valid Red Hat Ansible Automation Platform subscription.

If the Ansible code bot is not configured correctly, it does not scan your Git repositories or does not create pull requests.

To resolve Ansible code bot errors, ensure that:

  • You have selected all the Git repositories that you want to scan.
  • You have a .yml configuration file named ansible-code-bot.yml in your repository .github folder. For example, .github/ansible-code-bot.yml.

Run a manual scan on your git repositories by adding the ansible-code-bot-scan topic to your repository. For more information, see Manually scan your Git repositories.

If the Ansible code bot still cannot scan your Git repository, the following scenarios are possible:

  • The Ansible code bot did not identify any ansible-lint violations in the Git repository.
  • The Ansible code bot does not have permission to scan the Git repository.
  • Your organization does not have a valid Red Hat Ansible Automation Platform subscription.

7.4.3. Cannot create pull requests

You might encounter an error where the Ansible code bot cannot create pull requests after scanning your Git repositories.

To resolve this error, ensure that:

Legal Notice

Copyright © 2025 Red Hat, Inc.
The text of and illustrations in this document are licensed by Red Hat under a Creative Commons Attribution–Share Alike 3.0 Unported license ("CC-BY-SA"). An explanation of CC-BY-SA is available at http://creativecommons.org/licenses/by-sa/3.0/. In accordance with CC-BY-SA, if you distribute this document or an adaptation of it, you must provide the URL for the original version.
Red Hat, as the licensor of this document, waives the right to enforce, and agrees not to assert, Section 4d of CC-BY-SA to the fullest extent permitted by applicable law.
Red Hat, Red Hat Enterprise Linux, the Shadowman logo, the Red Hat logo, JBoss, OpenShift, Fedora, the Infinity logo, and RHCE are trademarks of Red Hat, Inc., registered in the United States and other countries.
Linux® is the registered trademark of Linus Torvalds in the United States and other countries.
Java® is a registered trademark of Oracle and/or its affiliates.
XFS® is a trademark of Silicon Graphics International Corp. or its subsidiaries in the United States and/or other countries.
MySQL® is a registered trademark of MySQL AB in the United States, the European Union and other countries.
Node.js® is an official trademark of Joyent. Red Hat is not formally related to or endorsed by the official Joyent Node.js open source or commercial project.
The OpenStack® Word Mark and OpenStack logo are either registered trademarks/service marks or trademarks/service marks of the OpenStack Foundation, in the United States and other countries and are used with the OpenStack Foundation's permission. We are not affiliated with, endorsed or sponsored by the OpenStack Foundation, or the OpenStack community.
All other trademarks are the property of their respective owners.
Back to top
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.

Theme

© 2025 Red Hat