Red Hat blog
At Red Hat Summit and AnsibleFest 2023, we announced Ansible Lightspeed with IBM Watson Code Assistant, a new generative AI service for Ansible. We followed that up with a technical preview of features in June 2023. Today, we are thrilled to announce that Red Hat Ansible Lightspeed with IBM watsonx Code Assistant is now available as a component service of the Red Hat Ansible Automation Platform.
Ansible Lightspeed with watsonx Code Assistant is engineered to help automation teams create, adopt, and maintain Ansible content more efficiently.
In this blog, we’ll walk through the steps to get Ansible Lightspeed with IBM watsonx Code Assistant up and running for your organization. We’ll share how end users can set up the service in their Visual Studio Code (VS Code) environment. We’ll also share more on what to expect from the experience and supplemental tools available to turbocharge your Ansible creator journey with generative AI capabilities built on a foundation of transparency, accuracy, and choice.
This is an exciting addition to the Ansible Automation Platform experience, so let’s kick things off.
Commercial features: Bringing AI to Ansible content creation through collaboration between Red Hat and IBM
Ansible Lightspeed with watsonx Code Assistant is the culmination of Red Hat and IBM teams combining forces to create a cohesive AI experience for Ansible content creation. Tapping into automation-specific IBM watsonx foundation models, it turns text prompts into Ansible content snippets for the creation of Ansible content. The generated content adheres to accepted Ansible best practices, and when combined with the Ansible code bot feature, teams can build more confidence in their automation code base.

The service consists of three components:
- The developer interface - Built natively into the VS Code extension via the Ansible extension, this allows Ansible content creators to use natural language prompts in the Ansible Playbooks or task files to generate Ansible Lightspeed single and multi-task suggestions.
- The integrated service - This acts as the glue or broker between the developer interface and the watsonx.ai service. It brings the power of AI to Ansible Automation Platform and enhances the responses from the AI with its post-processing capabilities.
- The AI - IBM watsonx Code Assistant provides access to Ansible-specific watsonx.ai foundation model that generates Ansible content recommendations. This is the “AI guts'' of the solution.
In the next steps, we will explain how you can set up and start using Ansible Lightspeed with watsonx Code Assistant.
Logging in and configuring Red Hat Ansible Lightspeed to connect to IBM watsonx Code Assistant
Note: This section is only intended for someone with organization administrator privileges on the Red Hat customer portal account for your organization. If that’s not you, jump down to the next section on how to get connected in the VS Code extension for Ansible.
As Red Hat customer portal administrator, you must configure Red Hat Ansible Lightspeed to connect to your IBM watsonx Code Assistant instance. This configuration enables Red Hat Ansible Lightspeed to communicate with your IBM watsonx Code Assistant instance.
You need the following IBM watsonx Code Assistant information to connect Red Hat Ansible Lightspeed:
- IBM watsonx Code Assistant (WxCA) API key
- A WxCA 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 WxCA API key. When an authenticated Red Hat Single Sign-On (SSO) user queries Red Hat Ansible Lightspeed for a suggestion, the WxCA 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 WxCA model ID identifies an IBM watsonx Code Assistant model in your IBM Cloud account. The model ID that you configure in the Red Hat Ansible Lightspeed administrator portal is used as the default model, thus it will be used to get suggestions from Ansible Lightspeed for all the users in your organization who are assigned a seat.. This single-tenant IBM watsonx Granite model is unique to your organization and your organization only, to help with data privacy, compliance, and security. These models are provided, managed and maintained by IBM.
Important: You must configure both the WxCA API key and the model ID when you are initially configuring Red Hat Ansible Lightspeed.
Prerequisites
- You have organization administrator privileges to a Red Hat Customer Portal organization with a valid Ansible Automation Platform subscription.
- You have obtained a WxCA API key and a model ID of the IBM watsonx Code Assistant that you want to use in Red Hat Ansible Lightspeed.
For information about how to obtain a WxCA API key and model ID from IBM watsonx Code Assistant, see the IBM watsonx Code Assistant documentation.
Procedure
- Log in to the Ansible Lightspeed portal as an organization administrator.
- Click Log in > Log in with Red Hat.
- Enter your Red Hat account username and password.
- The Red Hat Ansible Lightspeed service uses Red Hat Single Sign-On (SSO) for authentication.
- As part of the authentication process, the Red Hat Ansible Lightspeed service checks whether you are an organization administrator, and whether your organization has a valid Ansible Automation Platform subscription. On successful authentication, the login screen is displayed along with your username and your assigned user role.
- From the login screen, click Admin Portal.
- You are redirected to the Ansible Lightspeed with watsonx Code Assistant administrator portal that you can use to connect Red Hat Ansible Lightspeed to your IBM watsonx Code Assistant instance.
- Specify the API key of your IBM watsonx Code Assistant instance and Click Save.
- Optional: Click Test to validate the API key
- Specify the model ID of the model that you want to use and click Save.
- Optional: Click Test to validate model ID.
- When the WxCA API key and model ID is successfully validated, Red Hat Ansible Lightspeed is connected to your IBM watsonx Code Assistant instance.
Assigning and removing seat licenses
Note: This section is only intended for someone with organization administrator privileges on the Red Hat customer portal account for your organization. If that’s not you, jump down to the next section on how to get connected in the VS Code extension for Ansible.
After connecting Red Hat Ansible Lightspeed to an IBM watsonx Code Assistant instance, Red Hat Customer Portal organization administrators can assign seat licenses to Ansible Automation Platform users in their organization. The seat assignment feature enables select Ansible Automation Platform users in your organization to access and use Red Hat Ansible Lightspeed.
Your Ansible Automation Platform subscription includes a specific number of Red Hat Ansible Lightspeed named seats depending on the number of subscriptions your organization has purchased. Red Hat Ansible Lightspeed authenticates users by using Red Hat Single Sign On (SSO) and verifies that they have an assigned seat license.
Assigning seat licenses
You can grant Red Hat Ansible Lightspeed seat licenses to select users in your organization.
Prerequisites
- You must be assigned as an organization administrator in the Red Hat Customer Portal.
- You have configured Red Hat Ansible Lightspeed to connect to IBM watsonx Code Assistant instance.
- You must be logged in to Ansible Automation Platform on the Red Hat Hybrid Cloud Console as an organization administrator.
Procedure
- Go to Ansible Automation Platform on the Red Hat Hybrid Cloud Console.
- From the navigation panel, select Ansible Lightspeed with IBM watsonx Code Assistant > Seat Management.
- Click Assign users.
- Enter the username of the user that you want to assign a seat license to.
- Click Assign, and on the verification message, click Ok to confirm.
And just like that, assigned seat users will now have access to Ansible Lightspeed with watsonx Code Assistant service.
Getting connected: Installation and configuration
Prerequisites
- Visual Studio Code and Ansible installed on your workstation
- A Red Hat customer portal account (that is attached to your organization)
- A seat assigned to your account by the Red Hat portal organization administrator for your organization to access the Red Hat Ansible Lightspeed service.
Procedure
- Install the Ansible VS Code extension from the Visual Studio Code Marketplace by searching for "ansible" and selecting the extension published by Red Hat. Minimum version for Ansible extension to work with Ansible Lightspeed service is 2.8.108, check version history here.
- Enable the Red Hat Ansible Lightspeed service within the extension by accessing the "Extension Settings" via the gear icon.
- In the settings, enable both "Ansible Lightspeed enabled" and "Enable Ansible Lightspeed with Watson Code Assistant inline suggestions" checkboxes.
Note: You can enable Red Hat Ansible Lightspeed in the “User” or “Workspace” settings, based on your preference. More information on VS Code User and Workspace settings can be found in their documentation.

Installing the Ansible Visual Studio Code extension
- Click on the Ansible "A" in the VS Code activity bar on the left-hand side of your editor to open the extension.
- Click "Connect" and follow the prompts to log into your Red Hat account using your credentials.
- Next, authorize Ansible Lightspeed for VS Code by clicking “Authorize”.
- Follow the browser prompts to redirect you back to VS Code, and, finally, click “Open” in the VS Code confirmation dialog box.

Log in using your Red Hat credentials
Congratulations! You’ve successfully configured Ansible Lightspeed with watsonx Code Assistant in VS Code.
You can confirm that Red Hat Ansible Lightspeed is enabled by checking the VS Code status bar at the bottom of the editor window.

Please ensure a Python environment is selected and your Ansible YAML files are associated with the Ansible language. More information on VS Code languages can be found in their documentation.
Create with Red Hat Ansible Lightspeed
Now that you are connected to Ansible Lightspeed with watsonx Code Assistant, it's time to experience its AI-enhanced content creation experience.
Let’s use an example Playbook to walk through asking Red Hat Ansible Lightspeed for AI-generated task suggestions and also highlight some of what you can expect from commercial features. The example playbook installs and configures PostgreSQL on all machines of the database host group.
Note: As part of our ongoing improvements to the service, IBM and Red Hat will keep pushing updates to improve the quality of recommendations. Therefore, Ansible task suggestions in the examples below may differ.
How do I generate a Red Hat Ansible Lightspeed suggestion?
Let’s use our first Playbook task in the configure_postgres.yml example Playbook to demonstrate asking Ansible Lightspeed with watsonx Code Assistant for an AI suggestion.
- Move your cursor to the end of the “- name: Install postgresql-server” task description.
- Press "ENTER" to generate a suggestion.
- Press "TAB" to accept the suggestion.

Generating an Ansible task
In this suggestion we asked the service to install “postgresql-server” package, the suggestion used the Fully Qualified Collection Name (FQCN) - ansible.builtin.package to reference the Ansible module to manage generic OS packages.
Using FQCNs is a recommended best practice and an example of the many unique post-processing capabilities we’ve baked into the Red Hat Ansible Lightspeed service.
Let’s move on to the next tasks.
How do I generate multiple task suggestions?
Now that we have got a suggestion back from the service to “Install postgresql-server”, we need to ask some more suggestions from the service to configure PostgreSQL, like
Run postgresql-setup command
Start and enable postgresql service
Allow the postgres traffic through the firewall
One option would be to follow the single-task mechanism to get recommendations for each task like we did in the above section.
An exciting new commercial feature of Ansible Lightspeed with watsonx Code Assistant is multi-task generation. A step on the roadmap towards full Playbook generation, multi-task generation allows you to generate multiple tasks with a single prompt entry, by chaining multiple tasks descriptions using ampersand (&) sign in a YAML comment at the task level.
Let’s use our same Playbook example and demonstrate asking the service for multi-task suggestions. We have already created a YAML comment in this file. If you look closely on line 12, you will see that we have chained the different tasks to configure PostgreSQL with ampersands (&) in a YAML comment at the task level.
- Move your cursor to the end of the line “# Run postresql-setup command & Start and enable postgresql service & Allow the traffic”, which is a YAML comment.
- Press "ENTER" to generate a suggestion with multiple.
- Press "TAB" to accept the suggestion.

Generating multiple Ansible tasks
In the same Playbook, this time we asked for multiple suggestions together to “Run postgresql-command”, “Start and enable postgresql service” and “Allow the traffic”. The suggestion returned three Ansible tasks in the suggestion this time.
Generating contextually aware, accurate Ansible content suggestions saves you time and helps you create efficiently. One of Red Hat Ansible Lightspeed’s superpowers is context. The last task just asks to “Allow the traffic”, which might seem counterintuitive as an AI “ask”, but the Red Hat Ansible Lightspeed service is aware of the Ansible Playbook it's working in and suggests a port suggestion to open which corresponds to the default port for PostgreSQL(5432).
Note: This is just an example to show a capability of Ansible Lightspeed with watsonx Code Assistant to the readers. When writing Ansible content, we recommend being explicit in the task names so it’s easy for anyone to understand your Ansible content.
Let’s move on to the next feature.
Adopt with built-in transparency: Content Source Matching
Another critical feature of Ansible Lightspeed with watsonx Code Assistant is transparency and openness using content source matching. We transparently share the potential source, author, and content license of the training data used for the recommendation. Building trust in the community and supporting the relationships between authors and contributors is part of Red Hat’s DNA

Ansible Lightspeed Content Source Matching
Adopt with Ansible best practices and more accuracy
Red Hat Ansible Lightspeed is solely focused on automation, which provides a streamlined and accurate generative AI experience that is tailored by—and for—IT automation teams. With post-processing capabilities that adhere to accepted best practices, automation teams can have confidence in the content they are accepting.
The post-processing capabilities of Red Hat Ansible Lightspeed enhance the Ansible content recommendations from IBM watsonx Code Assistant for best practices. For instance, using FQCN, doing data anonymization and variable substitutions among other things.
The example in the “how to generate a suggestion” section above showed the suggestions generated with FQCNs as one of the post-processing capabilities of the service.
Maintain: Ansible code bot (Services Preview)
Customers often ask, “we have the content, but what's next”? How do we move from siloed automation? How do we create a Community of Practice?
Our answer starts with culture, and treating infrastructure workflows as software assets catalyzes the collaborative approach needed for enterprise-level automation.
However, this could involve learning new skills like version control, automated testing, and code review. Our goal with Ansible code bot is to extend Ansible content quality improvement beyond creation and into your entire workflow.
The Ansible code bot scans existing Ansible Content Collections, roles, and Playbooks hosted in GitHub 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 . You can configure Ansible code bot to scan your existing Git repositories (both public and private).
Ansible code bot uses Ansible lint to recommend Ansible content quality improvements. It is intended to promote proven practices, patterns, and behaviors while avoiding common errors that can easily lead to bugs or make content harder to maintain. Ansible code bot scans your content based on the configured rules, to ensure that your content adheres to Ansible best practices.
Prerequisites
- A Red Hat customer portal account that is attached to your organization.
- Your organization should have a valid Ansible Lightspeed with watsonx Code Assistant subscription enabled.
Procedure
- Log in to your GitHub by using an account associated with your organization.
- Install the GitHub app for the organization that you are a member of.
- Go to the Ansible code bot GitHub app:
- Select the repositories on which you want to install the Ansible code bot.
- Click Install & Authorize.
- When prompted, log in to your Red Hat SSO account.

Ansible Code bot in action
After the Ansible code bot is installed for the Git repositories you selected, you can configure a schedule to scan your Git repositories at regular intervals. You can also manually scan your Git repositories by adding a topic called “ansible-code-bot-scan” to your repository, if you have not set up a scanning schedule for your Ansible code bot or if you do not want to wait for the next scheduled scan.
Note: Service Preview is the initial release “phase” for a Cloud Service. Service Previews are made available to selected internal and external customers to gather initial feedback on a service, but not for production usage. In addition, individual features of a Cloud Service in the Field Trial, Limited Availability, or General Availability phase can be documented as Service Preview, meaning the feature is not for production use.
Wrap-up
Congratulations! You have successfully configured Ansible Lightspeed with watsonx Code Assistant for your organization. You’ve also put some exciting new generative AI capabilities to work with just a few simple steps.
We encourage you to join the Ansible Lightspeed Matrix room, which is a great place to share your feedback, get the latest news, and receive answers from your automation peers and the Red Hat team.
Next steps + resources
For more information on next steps, check out the Red Hat Ansible Lightspeed homepage, where there are links for existing Red Hat customers and those interested in trying Ansible Automation Platform.
Additional resources as you explore Ansible and generative AI:
- Overview video
- Press release: Red Hat Launches Red Hat Ansible Lightspeed with IBM watsonx Code Assistant for AI-Driven Enterprise IT Automation
- Product Documentation: Red Hat Ansible Lightspeed with IBM watsonx Code Assistant
- Video: A RedMonk Conversation: AI and IT automation with Ansible
- Red Hat Ansible Lightspeed datasheet
- Blog: The evolution of Ansible: Empowering people and technology
- The Red Hat Ansible Lightspeed YouTube playlist will continue to be updated with helpful demos and feature explainers.
- For more insight on IBM’s Ansible-specific foundation model, check out the IBM watsonx Code Assistant page.
We’ll keep the blogs, videos and other resources coming as this service evolves to help you get the most out of generative AI - the Ansible way.
Thanks for reading, and happy automating.
About the author
Anshul is a Principal Marketing Manager at Red Hat, where he brings his software development and QE experience to increase Ansible Automation Platform's adoption experience for customers by producing technical content on all aspects of the product.