Ansible Lightspeed with IBM Watsonx: AI-Powered Automation in 2025
Ansible Lightspeed is Red Hat AI-powered assistant that helps you write Ansible content faster and with fewer errors. Powered by IBM Watsonx foundation models, it brings generative AI capabilities directly into your automation workflow. This guide explores how to use Ansible Lightspeed effectively in 2025.
📑 Table of Contents
- What is Ansible Lightspeed?
- How It Works
- Getting Started
- Prerequisites
- Installation
- Using Natural Language Prompts
- Example 1: Installing Packages
- Example 2: User Management
- Example 3: Service Configuration
- Code Completion Features
- Module Suggestions
- Parameter Completion
- Best Practices with Lightspeed
- 1. Write Clear Descriptions
- 2. Review Generated Code
- 3. Use Context
- Integration with AAP 2.6
- Model Context Protocol (MCP) Preview
- Privacy and Security
- Comparison with Other AI Tools
- Getting the Most from AI Assistance
- Conclusion
What is Ansible Lightspeed?
Ansible Lightspeed is an AI assistant integrated into VS Code and Ansible Automation Platform that provides:
- Natural language to Ansible – Describe tasks in plain English
- Code completion – Intelligent suggestions as you type
- Best practice recommendations – AI suggests optimal modules
- Syntax validation – Catches errors before execution
- Context-aware suggestions – Understands your existing code
How It Works
The technology stack includes:
- IBM Watsonx – Foundation models trained on Red Hat and IBM data
- Red Hat Ansible expertise – Models fine-tuned on Ansible best practices
- Content filtering – Ensures suggestions follow security guidelines
- Model Context Protocol (MCP) – New integration with Anthropic technology (preview)
Getting Started
Prerequisites
- Visual Studio Code
- Red Hat Ansible Lightspeed subscription (or trial)
- Ansible extension for VS Code
Installation
- Open VS Code
- Install the “Ansible” extension from Red Hat
- Open Settings (Ctrl+,)
- Search for “Ansible Lightspeed”
- Enable Lightspeed and authenticate with your Red Hat account
# VS Code settings.json
{
"ansible.lightspeed.enabled": true,
"ansible.lightspeed.suggestions.enabled": true,
"ansible.lightspeed.URL": "https://c.ai.ansible.redhat.com"
}
Using Natural Language Prompts
The most powerful feature is converting natural language descriptions into Ansible tasks. Simply write a comment describing what you want:
Example 1: Installing Packages
# Type this comment in your playbook:
# Install nginx, certbot, and postgresql on RHEL servers
# Lightspeed generates:
- name: Install nginx, certbot, and postgresql on RHEL servers
ansible.builtin.dnf:
name:
- nginx
- certbot
- postgresql-server
state: present
when: ansible_os_family == "RedHat"
Example 2: User Management
# Create a new user called developer with sudo access and SSH key
# Lightspeed generates:
- name: Create developer user with sudo access
ansible.builtin.user:
name: developer
groups: wheel
append: true
shell: /bin/bash
state: present
- name: Add SSH authorized key for developer
ansible.posix.authorized_key:
user: developer
key: "{{ developer_ssh_key }}"
state: present
Example 3: Service Configuration
# Configure nginx as a reverse proxy for port 3000 with SSL
# Lightspeed generates complete nginx configuration task
# including template deployment and handler setup
Code Completion Features
Module Suggestions
When you start typing a task, Lightspeed suggests appropriate modules:
- name: Copy configuration file
# Start typing "ansible." and Lightspeed suggests:
# ansible.builtin.copy
# ansible.builtin.template
# ansible.builtin.file
Parameter Completion
Once you select a module, it suggests required and common parameters:
- name: Deploy configuration
ansible.builtin.template:
# Lightspeed suggests:
# src: (required)
# dest: (required)
# owner:
# group:
# mode:
Best Practices with Lightspeed
1. Write Clear Descriptions
The quality of suggestions depends on your prompts:
# Bad: vague prompt
# setup web server
# Good: specific prompt
# Install nginx on RHEL 9, configure virtual host for example.com on port 443 with SSL
2. Review Generated Code
Always review AI-generated suggestions:
- Verify module names are correct
- Check for hardcoded values that should be variables
- Ensure security best practices
- Test in non-production first
3. Use Context
Lightspeed understands context from your existing playbook:
---
- hosts: webservers
become: true
vars:
app_user: myapp
app_path: /opt/myapp
tasks:
# When you add a task here, Lightspeed knows about
# app_user and app_path variables and will use them
Integration with AAP 2.6
In Ansible Automation Platform 2.6, Lightspeed is integrated into:
- Development Workspaces – Browser-based VS Code with Lightspeed
- Content Creation – AI assistance when writing automation
- Troubleshooting – Suggestions for fixing failed tasks
Model Context Protocol (MCP) Preview
Red Hat has previewed support for Anthropic Model Context Protocol in Lightspeed. This enables:
- More sophisticated context understanding
- Better multi-file project awareness
- Integration with external tools and data sources
- Enhanced reasoning capabilities
Privacy and Security
Important security considerations:
- Data processing – Code snippets are sent to IBM Watsonx for processing
- Content filtering – Suggestions are filtered for security issues
- No training on your data – Your code is not used to train models
- Audit logging – All interactions are logged for compliance
Comparison with Other AI Tools
| Feature | Ansible Lightspeed | Generic AI (ChatGPT/Claude) |
|---|---|---|
| Ansible-specific training | Yes | General knowledge |
| IDE integration | Native VS Code | Copy/paste |
| Context awareness | Full project | Limited |
| Content filtering | Ansible-focused | General |
| Enterprise support | Red Hat | Varies |
Getting the Most from AI Assistance
- Start with structure – Create your playbook skeleton first
- Use comments liberally – Describe intent before each task
- Iterate on suggestions – Refine prompts if results are not ideal
- Learn from suggestions – AI can teach you new modules and patterns
- Combine with testing – Use molecule to validate AI-generated code
Conclusion
Ansible Lightspeed represents a significant advancement in automation tooling. By combining IBM large language models with Red Hat Ansible expertise, it accelerates playbook development while maintaining best practices. The AI does not replace Ansible knowledge but augments it, helping both beginners learn faster and experts work more efficiently.
As AI continues to evolve with features like MCP integration, expect even more sophisticated assistance in the future. The key is to use AI as a productivity tool while maintaining human oversight and understanding of the automation you deploy.
Try Ansible Lightspeed with a free trial at ansible.com/products/lightspeed.
Was this article helpful?
About Ramesh Sundararamaiah
Red Hat Certified Architect
Expert in Linux system administration, DevOps automation, and cloud infrastructure. Specializing in Red Hat Enterprise Linux, CentOS, Ubuntu, Docker, Ansible, and enterprise IT solutions.