Lab Guide: Configuring Ansible Lightspeed in VS Code
A guide to enabling and activating Ansible Lightspeed within the Ansible Visual Studio Code extension.
Introduction and Lab Setup
|
Important Note About This Lab IBM watsonx Code Assistant models are continuously updated and improved. As a result, some specific task generation challenges in this lab may not work exactly as described due to model updates. This is expected behavior. The primary goal of this lab is to help you understand the key features of Ansible Lightspeed, including:
If a specific prompt doesn’t generate suggestions as expected:
|
In this lab, you will configure Ansible Lightspeed in Visual Studio Code. You will sign up for the Ansible Lightspeed trial service using your own Red Hat account.
The examples used in this lab are available in the Ansible Lightspeed Demo repository.
Your lab environment provides access to multiple services via the tabs at the top:
-
VS Code - Visual Studio Code development environment with Ansible extension pre-installed
-
Ansible Automation Platform - Automation controller for running automation jobs
-
Cockpit - Cockpit web console for system monitoring (after setup in Module 2)
-
PGAdmin - PostgreSQL administration interface (after setup in Module 3)
-
AWS/Azure - Cloud account credentials for AWS and Azure resources (used in later challenges)
-
gitea - Internal Git repository hosting the lab playbooks
|
Lab Credentials Different services in this lab use different credentials:
|
Task 1: Sign Up for Ansible Lightspeed Trial
Before using Ansible Lightspeed, you need to sign up for a trial subscription. This requires creating a Red Hat account and subscribing to both Ansible Automation Platform and Ansible Lightspeed trials.
|
If you have previously completed this lab:
|
|
If you already have a Red Hat account with active Ansible Lightspeed trial access, you can skip to Task 2. |
Step 1: Create a Red Hat Account
-
Visit the Red Hat account creation page at access.redhat.com
-
Complete the registration form with your information and verify your email address.
Step 2: Subscribe to Ansible Automation Platform Trial
-
Visit the Ansible Automation Platform trial page at https://www.redhat.com/en/technologies/management/ansible/trial
-
Log in with your newly created Red Hat account credentials.
-
Complete the trial signup process for Ansible Automation Platform.
|
You must have an active Ansible Automation Platform trial subscription before you can access the Ansible Lightspeed trial. |
Task 2: Enable and Connect Ansible Lightspeed in VS Code
Now you will enable Ansible Lightspeed in VS Code and connect it to the trial service.
Step 1: Open VS Code and Enable Lightspeed Settings
-
Access VS Code:
-
VS Code opens automatically as the first tab when you start the lab
-
If you need to reopen it, click the VS Code tab at the top of your lab environment
-
Note: Clicking the VS Code tab may open it in a new browser tab
-
|
Work in a new browser tab: For the best experience with Ansible Lightspeed features, click the VS Code tab to open it in a new browser tab rather than using the inline embedded window. |
-
Navigate to the Ansible extension settings:
-
Click the Extensions icon on the left sidebar
-
Find the Ansible extension
-
Click the gear icon (⚙️)
-
Select Extension Settings
-
-
Enable Lightspeed features:
-
Click the Workspace tab
-
Type
lightspeedin the search bar to filter settings -
Check both boxes:
-
Enable Ansible Lightspeed
-
Enable Ansible Lightspeed with Watson Code Assistant inline suggestions
-
-
|
Please ensure you configure these settings in the VS Code Workspace tab, not the User tab. |
|
If VS Code prompts you to Reload Window to update the extensions, click the Reload Window button to apply the changes. |
Step 2: Connect to Ansible Lightspeed Service
-
Click the Ansible extension icon on the left sidebar in VS Code.
-
Click the Connect button in the Ansible Lightspeed section.
-
Follow the authentication prompts:
-
VS Code will show pop-ups guiding you through authentication
-
Click Allow when prompted to open the authentication page
-
Click Open to launch your browser
-
-
Log in with your Red Hat account:
-
A browser window will open to the Red Hat login page
-
Enter your Red Hat account credentials (the account you created in Task 1)
-
Click Log In
-
-
Authorize VS Code to access Ansible Lightspeed:
-
After logging in, you’ll see an authorization page
-
Click Authorize to grant VS Code access
-
-
Complete the authentication redirect:
-
The browser will redirect back to VS Code
-
Click Open in the VS Code prompt to complete the connection
-
You should now see
Logged in as <your-email>in the Ansible extension sidebar
-
-
Start the Ansible Lightspeed trial:
-
In the Ansible extension sidebar (left side), look for the Start Trial button in the Ansible Lightspeed section
-
Click the Start Trial button
-
A browser window will open with the Ansible Lightspeed trial terms and conditions
-
Read and accept the terms and conditions
-
After accepting, the browser will confirm your trial is activated
-
-
Refresh and verify the trial is enabled:
-
Return to VS Code
-
In the Ansible Lightspeed section of the Ansible extension sidebar, click the refresh icon (circular arrow)
-
You should now see that your Ansible Lightspeed trial is enabled and active
-
A confirmation notification may appear in the bottom right corner
-
|
The Ansible Lightspeed trial is NOT automatically activated after AAP trial signup. You must explicitly click Start Trial in VS Code and accept the terms and conditions for the trial to become active. |
|
If you receive a timeout warning during authentication, simply click Connect in the Ansible extension again and repeat the authorization steps. |
Task 3: Understanding Playbook Generation (Optional)
Now that you’ve set up Ansible Lightspeed, let’s explore the playbook generation feature. This is one of the most powerful features of Ansible Lightspeed, allowing you to create entire playbooks from natural language prompts.
|
Work in a new browser tab: Ansible Lightspeed may not work correctly in the inline VS Code window embedded in the lab interface. Always click the VS Code tab to open it in a new browser tab for the best experience with Lightspeed features. |
Step 1: Access Playbook Generation
-
Open the playbook generation interface:
-
On the left side of VS Code, click the Ansible icon (looks like an "A")
-
In the Ansible Lightspeed section, click the Generate a playbook button
-
Note: This button only appears after you have successfully logged in and activated your trial
-
-
Step 2: Enter Your Prompt
-
Describe what you want to achieve:
-
A new screen will open with a text box labeled "Describe what you want to achieve in natural language"
-
Enter a description of what you want your playbook to do
-
Click the Analyze button
-
|
Writing effective prompts:
Example prompts:
You’ll also see example prompts listed in the interface that you can use for inspiration. |
Step 3: Review and Edit the Outline
-
Review the suggested playbook structure:
-
After clicking Analyze, Ansible Lightspeed will show an outline of the playbook
-
The outline shows the suggested steps for your playbook
-
The outline is editable - you can modify the steps as needed to match your requirements
-
Review the outline and make any adjustments if necessary
-
-
Generate the playbook:
-
Once you’re satisfied with the outline, click the Continue button
-
Ansible Lightspeed will generate the complete playbook based on the outline
-
Step 4: Save the Playbook
-
Save your generated playbook:
-
The playbook will open as "Untitled" in the editor
-
Press
CTRL+S(Windows/Linux) orCMD+S(Mac) to save the file -
Give your playbook a descriptive name ending with
.yml(for example:install_apache.yml,configure_database.yml) -
Choose a location to save it (the
playbooks/directory is recommended for organization)
-
|
You can experiment with playbook generation now, or proceed to the next module where you’ll use both task generation and playbook generation features in hands-on challenges. |
Next Steps
Congratulations! You have successfully configured Ansible Lightspeed in VS Code. You are now ready to start generating Ansible content using AI-powered suggestions.
|
Do not skip this module! Without completing the Ansible Lightspeed setup, you will not be able to get AI suggestions in the subsequent challenges. |
Press the button below to proceed to the next module where you will use Ansible Lightspeed to deploy Cockpit.
Additional Resources
-
More information on Red Hat Ansible Lightspeed with IBM watsonx Code Assistant
-
Ansible Automation Platform Trial - Sign up for AAP trial
Troubleshooting
Common Issues
Issue: "I’m logged in but don’t see the Start Trial button"
-
Solution: Make sure you have completed the AAP trial signup first. The Start Trial button only appears if you have an active AAP trial subscription. Try clicking the refresh icon in the Ansible Lightspeed section.
Issue: "I clicked Start Trial but my trial still shows as not enabled"
-
Solution: After accepting the terms and conditions in the browser, return to VS Code and click the refresh icon (circular arrow) in the Ansible Lightspeed section of the Ansible extension sidebar.
Issue: "I don’t see the option to enable Ansible Lightspeed trial"
-
Solution: Ensure you have completed the Ansible Automation Platform trial signup first. The Lightspeed trial requires an active AAP trial subscription.
Issue: "Connection times out during authentication"
-
Solution: Click Connect in the Ansible extension again and repeat the authorization steps. Make sure pop-ups are not blocked in your browser.
Issue: "I already have a Red Hat account but no AAP trial"
-
Solution: Visit the AAP trial page and sign up using your existing Red Hat account.
Issue: "My 60-day trial has expired and I don’t have another email address"
-
Solution: Unfortunately, there is no workaround. Each Red Hat account can only activate the trial one time. You would need a different email address to create a new account.
If you encounter other issues, please check the official documentation or contact Red Hat support.