LLM Provider Support for Ansible Lightspeed¶
The Ansible VS Code extension supports multiple LLM providers including Red Hat Ansible Lightspeed with watsonx Code Assistant (WCA), Google Gemini, and Red Hat AI for Ansible code generation and assistance.
Supported Features¶
When using LLM providers, the following Ansible Lightspeed features are available:
Supported:
- Playbook Generation
- Role Generation
- Playbook Explanation
- Role Explanation
- Interactive Chat (if provider supports it)
Not Supported:
- Content Source Matching (WCA only)
Supported Providers¶
IBM watsonx (WCA)¶
The default provider. Uses Red Hat Ansible Lightspeed with IBM watsonx Code Assistant.
Configuration:
- Provider:
wca - API Endpoint:
https://c.ai.ansible.redhat.com(default) - Authentication: OAuth2 (Red Hat SSO)
Google Gemini¶
Direct access to Google Gemini models.
Configuration:
- Provider:
google - API Endpoint:
https://generativelanguage.googleapis.com/v1beta(fixed, not configurable) - API Key: Your Google AI API key (starts with
AIza) - Model Name: e.g.,
gemini-2.5-flash,gemini-1.5-pro
Note: For Google provider, the API endpoint is automatically set and cannot be changed.
Red Hat AI¶
Supports models hosted on the Red Hat AI platform. This provider communicates using the standard /v1/chat/completions API and authenticates with a Bearer token.
Configuration:
- Provider:
rhcustom - API Endpoint: Base URL of your deployment (required)
- API Key: Your API key for the endpoint (required)
- Model Name: The model to use, e.g.,
Granite-3.3-8B-Instruct(required) - Max Tokens: Maximum tokens per response (optional, defaults to 1600)
Note: The endpoint must expose an OpenAI-compatible
/v1/chat/completionsroute. Provide only the base URL (e.g.,https://my-api.example.com); the extension appends/v1/chat/completionsautomatically.
Setup Instructions¶
Method 1: LLM Provider Settings Panel (Recommended)¶
The LLM Provider Settings panel provides a visual interface to configure all providers. It can be accessed from the Ansible Development Tools (ADT) sidebar under the Generative AI section, or from the Command Palette.
- Open the Command Palette (
Ctrl+Shift+P/Cmd+Shift+P) - Run:
Ansible Lightspeed: Open LLM Provider Settings - The panel displays all available providers (IBM watsonx, Google Gemini, Red Hat AI)
- Click Edit on the provider you want to configure
- Fill in the required fields (API Endpoint, API Key, Model Name, etc.)
- Click Save
- Click Connect to validate the connection
- Click Switch to this Provider to make it the active provider
Provider settings are stored securely: API keys use VS Code's secret storage, and other values are kept in global state. This approach avoids storing sensitive credentials in plain-text settings files.
Method 2: Guided Configuration (Command Palette)¶
This method uses a step-by-step Command Palette flow with input prompts instead of the visual panel.
- Open the Command Palette (
Ctrl+Shift+P/Cmd+Shift+P) - Run:
Ansible Lightspeed: Configure LLM Provider - Select your desired provider from the list
- Enter the required configuration details when prompted
- Test the connection when prompted
Method 3: Workspace Configuration (Legacy)¶
Note: The
ansible.lightspeed.provider,apiEndpoint,modelName, andapiKeysettings insettings.jsonare deprecated. Existing values are automatically migrated to the LLM Provider Settings panel on first activation. The Red Hat AI provider is not available through the legacysettings.jsonsettings (theansible.lightspeed.providerenum only includeswcaandAnsible Lightspeed: Configure LLM Providercommand to set up Red Hat AI.
For WCA, you can still use workspace settings:
Configuration Settings¶
Settings managed through the LLM Provider Settings panel:
| Setting | Description | Default | Applicable To |
|---|---|---|---|
| API Endpoint | API endpoint URL | Varies per provider (see note below) | WCA, Google, Red Hat AI |
| API Key | API key for authentication | Google, Red Hat AI | |
| Model Name | Model name/ID to use | Google, Red Hat AI | |
| Max Tokens | Max tokens per response | 1600 |
Red Hat AI |
API Endpoint defaults:
- WCA:
https://c.ai.ansible.redhat.com - Google:
https://generativelanguage.googleapis.com/v1beta(fixed, not configurable) - Red Hat AI: Required, no default. Must point to an OpenAI-compatible endpoint.
Global settings in settings.json:
| Setting | Description | Default |
|---|---|---|
ansible.lightspeed.enabled |
Enable/disable Ansible Lightspeed | true |
ansible.lightspeed.timeout |
Request timeout in milliseconds | 30000 |
ansible.lightspeed.suggestions.enabled |
Enable inline suggestions (WCA) | true |
ansible.lightspeed.suggestions.waitWindow |
Delay before inline suggestion | 0 |
Usage¶
Once configured, LLM providers work seamlessly with existing Ansible Lightspeed features.
Playbook Generation¶
- Open the Command Palette or right-click in an Ansible file
- Select Generate Ansible Playbook with Lightspeed
- Enter your requirements
- Review the generated outline and edit steps if needed
- Accept the generated playbook
Example prompt:
Role Generation¶
- Open the Command Palette or right-click in an Ansible file
- Select Generate Ansible Role with Lightspeed
- Enter your requirements
- Review the generated outline and edit steps if needed
- Accept the generated role
Example prompt:
Create a role that installs PostgreSQL, initializes the database,
creates an application user, and enables the service
Playbook Explanation¶
- Open an existing Ansible playbook in the editor
- Right-click in the editor
- Select Explain the current Ansible playbook with Lightspeed
- The provider returns a Markdown explanation with a titled paragraph for each task, describing its purpose and the parameters used
Example: Given a playbook that installs and configures Apache, the explanation output includes a heading and paragraph for each task with details on the modules and parameters involved.
Role Explanation¶
- Open a file inside an Ansible role (e.g.,
tasks/main.yml) - Right-click in the editor
- Select Explain the current Ansible role with Lightspeed
- The provider aggregates all role files and returns a Markdown explanation covering each task in the role
Interactive Chat¶
- Open the Ansible Lightspeed panel
- Use the chat interface to ask Ansible-related questions
- The LLM provider will provide Ansible-specific assistance
Provider Management Commands¶
Access these commands via the Command Palette (Ctrl+Shift+P / Cmd+Shift+P):
Ansible Lightspeed: Open LLM Provider Settings- Open the settings panelAnsible Lightspeed: Configure LLM Provider- Guided setupAnsible Lightspeed: Test Provider Connection- Verify connectivityAnsible Lightspeed: Show Provider Status- View current configurationAnsible Lightspeed: Switch Provider- Change the active provider
Switching Between Providers¶
Use the LLM Provider Settings panel to switch providers:
- Open the Command Palette (
Ctrl+Shift+P/Cmd+Shift+P) - Run:
Ansible Lightspeed: Open LLM Provider Settings - Click Switch to this Provider on the provider you want to activate
Or use the quick switch command:
- Open the Command Palette
- Run:
Ansible Lightspeed: Switch Provider - Select your desired provider from the list
Security Considerations¶
-
API Key Storage: API keys entered through the LLM Provider Settings panel are stored in VS Code's secret storage, not in plain-text settings files.
-
Data Privacy: When using LLM providers, your Ansible code and prompts are sent to external services. Review each provider's privacy policy.
-
Workspace Settings: For team projects, avoid committing API keys to version control. Use the LLM Provider Settings panel or environment variables.
-
Network Security: Ensure your network allows HTTPS connections to the provider endpoints.
Troubleshooting¶
Connection Issues¶
- Test Connection: Use the Connect button in the LLM Provider Settings panel or run:
-
Check API Key: Ensure your API key is valid and has sufficient credits/quota.
-
Verify Endpoint: Confirm the API endpoint URL is correct. For Red Hat AI, the endpoint must expose
/v1/chat/completions. -
Network Access: Check firewall/proxy settings for connectivity to the provider endpoint.
Common Error Messages¶
| Error | Solution |
|---|---|
| "Authentication failed" | Check your API key |
| "Rate limit exceeded" | Wait and try again, or check your quota |
| "Request timeout" | Increase timeout setting or check network |
| "Model not found" | Verify the model name is correct for your provider |
| "Base URL must use http:// or https://" | Ensure the API endpoint starts with http:// or https:// |
Debug Information¶
Check the "Ansible Support" output channel in VS Code for detailed provider logs.
Model Recommendations¶
IBM watsonx (WCA) Models¶
Uses organization default model. No manual model selection needed.
Google Gemini Models¶
- For Code Generation:
gemini-2.5-flashorgemini-1.5-pro - For Chat/Explanations:
gemini-2.5-flash(fast and cost-effective)
Red Hat AI Models¶
The supported models in Red Hat AI platform depend on what is deployed at your endpoint. Common models include:
Granite-3.3-8B-Instruct(general-purpose Ansible tasks)DeepSeek-R1-Distill-Qwen-14B-W4A16(complex reasoning)
Known Limitations¶
All Non-WCA Providers¶
- Content source matching is not available. Only WCA provides training data attribution.
Red Hat AI Limitations¶
- The API endpoint must be an OpenAI-compatible service exposing
/v1/chat/completions. - There is no default model. You must specify a valid model name available at your endpoint.
- Max tokens defaults to 1600. Adjust this value based on your model's capabilities.
- Role generation produces only the
tasks/main.ymlfile. Other role directories (handlers, vars, defaults, templates) are not generated.
Provider-Specific¶
- Rate limits and quotas vary by provider and deployment.
- Model capabilities and response quality differ across models.
- Costs vary by usage and provider billing model.
Prerequisites¶
| Requirement | WCA | Red Hat AI | |
|---|---|---|---|
| Ansible Lightspeed enabled | Yes | Yes | Yes |
| Red Hat SSO / OAuth2 | Yes | No | No |
| API Key | No | Yes | Yes |
| API Endpoint | Yes | Auto | Yes |
| Model Name | No | Yes | Yes |
| Network access to provider endpoint | Yes | Yes | Yes |
| Ansible Automation Platform subscription | Yes | No | No |
Support¶
For issues with LLM provider integration:
- Check this documentation
- Test your provider configuration using the LLM Provider Settings panel
- Review the troubleshooting section
- File an issue on the Ansible VS Code Extension repository
For provider-specific issues (API keys, billing, model availability), contact your provider's support directly.