Lab Guide: Ansible Lightspeed Playground
This guide provides an overview of the Ansible Lightspeed playground environment and instructions for exploring its features.
Introduction and 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:
|
This challenge provides a playground demo environment for the Ansible Lightspeed with IBM watsonx Code Assistant commercial service. This is for you to experiment with the use cases that best suit your workflows.
All demo content is available in the Ansible Lightspeed demos repository.
|
Playground Environment: This is a free-form playground where you can explore all the Ansible Lightspeed features you’ve learned. All demo playbooks from previous modules are available here. Credentials:
* Ansible Automation Platform: |
The Playground Environment
This lab is designed as a "choose your own adventure" playground. The following tabs are available for you to explore.
| Tab name | Description |
|---|---|
VS Code |
Visual Studio Code with Ansible extension and Lightspeed configured |
Ansible Automation Platform |
Automation controller for running job templates |
Cockpit |
Cockpit web console (available after running Cockpit demo) |
PGAdmin |
PgAdmin interface (available after running PostgreSQL demo) |
AWS/Azure |
Cloud account credentials for AWS and Azure demos |
gitea |
Git repository containing all demo playbooks |
How to Run a Demo
All instructions are also available in the README of the repository.
Select a Demo in VS Code
-
Open VS Code by clicking the VS Code tab at the top of your lab environment.
|
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. |
-
Browse the demo playbooks.
-
On the left side of VS Code, click the Explorer icon (two overlapping documents)
-
Expand the playbooks folder to see all available demos:
-
playbooks/infra/install_cockpit/ - Cockpit deployment demo
-
playbooks/infra/install_pgsql_and_pgadmin/ - PostgreSQL and PGAdmin demo
-
playbooks/cloud/aws/ - AWS EC2 provisioning demo
-
playbooks/cloud/azure/ - Azure VM provisioning demo
-
-
-
Open a demo playbook.
-
Navigate to any demo folder (e.g.,
playbooks/infra/install_cockpit/) -
You’ll see two playbooks:
-
demo_<playbook_name>.yml - Starting point with prompts for Lightspeed
-
solution_<playbook_name>.yml - Complete solution for reference
-
-
Open the
demo_<playbook_name>.ymlfile to start the demo
-
Execute the Playbook
You can choose to run the demo_*.yml Playbook using either automation controller or ansible-navigator.
Option 1: Using Automation Controller
-
Commit and push the playbook to Git.
-
On the left side of VS Code, click the Source Control icon (branch with circles)
-
Hover over your changed file and click the + icon to stage it
-
Type a commit message in the "Message" box
-
Click the Commit button (checkmark icon)
-
Click Sync Changes to push to Git
-
-
Run the corresponding Job Template.
-
Click the Ansible Automation Platform tab at the top
-
Log in with
admin/ansible123!if prompted -
Click Resources → Templates on the left sidebar
-
Find the matching job template for your demo:
Job Template name Demo Playbook Deploy monitoring
demo_install_cockpit.ymlDeploy PostgreSQL and PG Admin
demo_install_pgsql_pgadmin.ymlProvision EC2 instance
demo_provision_ec2_instance.ymlProvision Azure VM
demo_provision_azure_vm.yml -
Click the launch icon (🚀) next to the template
-
Wait for the job to complete successfully
-
Option 2: Using ansible-navigator
-
Open a terminal in VS Code.
-
Make sure you’re on the VS Code tab
-
Click Terminal → New Terminal from the top menu
-
A terminal panel will open at the bottom
-
-
Navigate to the demo folder.
In the terminal, type a command like this (adjust for your chosen demo):
cd playbooks/infra/install_cockpit -
Run the playbook.
Type the command and press `ENTER`:
ansible-navigator run demo_install_cockpit.ymlPress the `ESC` key to return to the prompt when done.
Help and Additional Information
Ansible Lightspeed Features
There are TWO main ways to use Ansible Lightspeed in this playground:
Method 1: Playbook Generation (Recommended)
Generate an entire playbook from scratch using natural language:
-
Access Playbook Generation:
-
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
-
-
-
Enter your prompt:
-
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. |
-
Review and edit the outline:
-
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
-
-
Save the 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) -
Note: If you save with the same name as a demo playbook (e.g.,
demo_install_cockpit.yml), you can use the existing job template in AAP. Otherwise, you’ll need to create a new job template
-
Method 2: Task Generation
Generate individual tasks within an existing playbook:
-
Single Task:
-
Uncomment a task name line by removing the
#(or pressCTRL+//CMD+/) -
Place your cursor at the end of the task name line
-
Press
ENTERto create a new line -
Lightspeed will show a suggestion in gray text
-
Press
TABto accept the suggestion
-
-
Multi-Task:
-
Find a comment line with multiple tasks separated by
& -
Do NOT uncomment - leave the
#in place -
Place your cursor at the end of the line
-
Press
ENTERto create a new line -
Lightspeed will generate multiple tasks
-
Press
TABto accept all suggestions
-
Solution Playbooks
If you need help or want to compare your work, solution playbooks are available in each demo folder with the solution_ prefix (e.g., solution_install_cockpit.yml).
Complete the Lab
Congratulations! You’ve explored the Ansible Lightspeed playground and learned how to use both playbook generation and task generation features!
Additional Resources
-
More information on Red Hat Ansible Lightspeed with IBM watsonx Code Assistant