Ansible Lightspeed with IBM watsonx Code Assistant is Red Hat's purpose-built AI service that generates Ansible automation code from plain English task descriptions. Unlike general-purpose AI tools like ChatGPT or GitHub Copilot, Lightspeed is specifically trained on Ansible content and understands playbook structure, module parameters, and automation best practices.
What Is Ansible Lightspeed?
Ansible Lightspeed is an AI-powered code assistant integrated into Visual Studio Code through the official Red Hat Ansible extension. When you write a task name in a playbook, Lightspeed generates the corresponding Ansible code — module name, parameters, and values — based on your natural language description.
The service was originally announced as Project Wisdom at AnsibleFest 2022 and launched as Ansible Lightspeed at Red Hat Summit 2023. It uses IBM's watsonx foundation models, specifically trained on Ansible Galaxy content, documentation, and curated automation examples.
Key Capabilities
- Task generation: Write a task name in English, get complete Ansible task code
- Context awareness: Understands your playbook structure, variables, and previous tasks
- Content source attribution: Shows which Ansible Galaxy collection or role influenced the suggestion
- Multi-task generation: Generate entire task sequences from descriptions
- Model customization: Organizations can tune the model on their own Ansible content (paid tier)
How Ansible Lightspeed Works
The AI pipeline works in several stages:
- Input: You type a task description as the
name:field in a YAML playbook - Context gathering: The extension sends the task name plus surrounding playbook context to the Lightspeed service
- Model inference: IBM watsonx Code Assistant processes the request using the Ansible-specific foundation model
- Code generation: The model returns a code recommendation matching your description
- Inline suggestion: VS Code displays the suggestion as ghost text you can accept or modify
# Example: Type this task name
- name: Install nginx and ensure it is running on Ubuntu
# Lightspeed generates:
ansible.builtin.apt:
name: nginx
state: present
notify: Start nginx
- name: Start nginx
ansible.builtin.service:
name: nginx
state: started
enabled: true
Setting Up Ansible Lightspeed
Prerequisites
- Visual Studio Code 1.70.1 or later
- Red Hat Ansible VS Code extension (latest version)
- GitHub account (for free tier authentication)
- Red Hat account (for commercial features)
Installation Steps
- Install the Ansible extension: Open VS Code Extensions (
Ctrl+Shift+X), search "Ansible", install the extension by Red Hat - Enable Lightspeed: Open VS Code Settings (
Ctrl+,), search "Ansible Lightspeed", check "Enable Ansible Lightspeed" - Authenticate: Click the Lightspeed icon in the status bar, sign in with your GitHub or Red Hat account
- Verify: Create a new
.ymlfile, set language to "Ansible" in the status bar, type a task name and wait for a suggestion
Configuration Options
Key settings in VS Code:
| Setting | Description | Default |
|---|---|---|
ansible.lightspeed.enabled | Enable/disable Lightspeed | false |
ansible.lightspeed.URL | Custom Lightspeed service URL | Red Hat hosted |
ansible.lightspeed.suggestions.enabled | Show inline suggestions | true |
ansible.lightspeed.model | Model identifier for custom models | Default model |
Writing Effective Prompts
The quality of Lightspeed suggestions depends heavily on how you write your task names. Here are proven patterns:
Good Task Descriptions
# Specific and descriptive — excellent results
- name: Create a user named deploy with sudo access and SSH key
- name: Configure firewalld to allow HTTP and HTTPS traffic
- name: Copy the nginx.conf template to /etc/nginx/nginx.conf with owner root
# Include target OS/platform when relevant
- name: Install PostgreSQL 15 on RHEL 9 using dnf
- name: Configure Windows Firewall to allow port 5985 for WinRM
Poor Task Descriptions
# Too vague — mediocre results
- name: Install package
- name: Configure service
- name: Copy file
# Non-descriptive
- name: Step 1
- name: Do the thing
Prompt Engineering Tips
- Be specific about the module: "Install nginx using apt" is better than "Install nginx"
- Include parameters: "Create user deploy with home directory /opt/deploy" gives targeted output
- Mention the target: "on RHEL 9" or "on Windows Server" helps select the right module
- Use FQCN in context: Having
ansible.builtin.in previous tasks encourages FQCN suggestions - Describe the desired state: "Ensure nginx is running and enabled" is clearer than "Start nginx"
Content Source Attribution
One unique feature of Ansible Lightspeed is content source attribution. When the model generates a suggestion, it can identify which Ansible Galaxy collection, role, or documentation page influenced the recommendation. This provides:
- Transparency: You know where the suggestion pattern came from
- License compliance: Verify the source content's license before using the suggestion
- Learning: Discover new collections and roles relevant to your work
Free Tier vs Commercial Tier
Free Tier (Ansible Lightspeed)
- Available to anyone with a GitHub account
- Single-task suggestions using the base IBM watsonx model
- Content source attribution
- Basic inline code completion
Commercial Tier (IBM watsonx Code Assistant for Red Hat Ansible)
- Multi-task generation from a single description
- Model customization: Train on your organization's Ansible content
- Post-processing rules to enforce coding standards
- Content source matching with organizational repos
- Enterprise support and SLA
- Available through Red Hat Ansible Automation Platform subscription
Ansible Lightspeed vs Other AI Tools
| Feature | Lightspeed | GitHub Copilot | ChatGPT |
|---|---|---|---|
| Ansible-specific training | ✅ Yes | ❌ General | ❌ General |
| FQCN awareness | ✅ Full | ⚠️ Partial | ⚠️ Partial |
| Content attribution | ✅ Yes | ❌ No | ❌ No |
| Playbook context | ✅ Deep | ⚠️ File-level | ❌ Prompt only |
| Ansible-lint compliance | ✅ Built-in | ❌ No | ❌ No |
| Model customization | ✅ Enterprise | ❌ No | ❌ No |
| Offline/on-premise | ✅ Enterprise | ❌ No | ❌ No |
Lightspeed produces more accurate Ansible code because the underlying model understands Ansible module parameters, required vs optional fields, and playbook structure. General AI tools often generate syntactically valid but semantically wrong Ansible code — for example, using deprecated module names or incorrect parameter combinations.
Common Issues and Troubleshooting
Suggestions Not Appearing
- Verify the file language is set to "Ansible" (not YAML) in the VS Code status bar
- Check that Lightspeed is enabled in settings
- Ensure you're authenticated (check the Lightspeed status bar icon)
- Verify network connectivity to the Lightspeed service
Low-Quality Suggestions
- Improve your task description (be more specific)
- Add context: fill in
hosts:,vars:, and previous tasks - Use FQCN for modules in surrounding tasks
- Check if the module you need exists in the model's training data
Authentication Issues
- Clear the VS Code Lightspeed credentials and re-authenticate
- For enterprise users, verify your Red Hat subscription includes watsonx Code Assistant
- Check proxy/firewall settings if behind a corporate network
Real-World Productivity Impact
Based on Red Hat's published case studies and our testing:
- 40-60% faster task writing for common operations (package install, service management, file operations)
- Reduced documentation lookups — Lightspeed knows module parameters
- Fewer syntax errors — generated code follows ansible-lint rules
- Better for beginners: Helps new Ansible users learn correct module usage and patterns
The biggest productivity gains come from:
- Generating boilerplate tasks (package management, file operations)
- Discovering the right module for a task (especially in large collections)
- Getting parameter names right without checking documentation
Best Practices
- Always review generated code — AI suggestions are recommendations, not guaranteed correct
- Validate with ansible-lint — run
ansible-linton generated playbooks - Test in development first — never deploy AI-generated code directly to production
- Use descriptive task names — benefits both Lightspeed accuracy and playbook readability
- Keep context clean — well-structured playbooks produce better suggestions
- Combine with Ansible Vault — Lightspeed respects
no_logand won't suggest exposing secrets
Links
- Ansible Lightspeed Documentation
- IBM watsonx Code Assistant
- Red Hat Ansible VS Code Extension
- Ansible Lightspeed Getting Started
Related Articles
- Ansible Lightspeed Beta Review: IBM Watson AI Enhances Development
- Elevating Ansible Development with Visual Studio Code
- Ansible Best Practices for Production Environments
- How to Install Ansible Step-by-Step
- Ansible vs Terraform — Which Tool When?
- Ansible Error Handling: blocks rescue always
- Ansible Fully Qualified Collection Name (FQCN)
Conclusion
Ansible Lightspeed with IBM watsonx Code Assistant represents a significant step forward in AI-assisted infrastructure automation. Unlike general-purpose AI coding tools, it is purpose-built for Ansible — understanding modules, parameters, collections, and playbook patterns at a deeper level.
For teams already using Ansible, Lightspeed reduces the friction of writing automation code, especially for common tasks and for team members newer to Ansible. The content source attribution feature addresses transparency concerns that other AI tools lack.
Whether you use the free tier for personal projects or the enterprise tier with model customization for organizational standards, Lightspeed accelerates the path from idea to working automation. Combined with ansible-lint and proper testing, it becomes a powerful addition to any Ansible developer's toolkit.