Skip to main content
Redhat Developers  Logo
  • Products

    Featured

    • Red Hat Enterprise Linux
      Red Hat Enterprise Linux Icon
    • Red Hat OpenShift AI
      Red Hat OpenShift AI
    • Red Hat Enterprise Linux AI
      Linux icon inside of a brain
    • Image mode for Red Hat Enterprise Linux
      RHEL image mode
    • Red Hat OpenShift
      Openshift icon
    • Red Hat Ansible Automation Platform
      Ansible icon
    • Red Hat Developer Hub
      Developer Hub
    • View All Red Hat Products
    • Linux

      • Red Hat Enterprise Linux
      • Image mode for Red Hat Enterprise Linux
      • Red Hat Universal Base Images (UBI)
    • Java runtimes & frameworks

      • JBoss Enterprise Application Platform
      • Red Hat build of OpenJDK
    • Kubernetes

      • Red Hat OpenShift
      • Microsoft Azure Red Hat OpenShift
      • Red Hat OpenShift Virtualization
      • Red Hat OpenShift Lightspeed
    • Integration & App Connectivity

      • Red Hat Build of Apache Camel
      • Red Hat Service Interconnect
      • Red Hat Connectivity Link
    • AI/ML

      • Red Hat OpenShift AI
      • Red Hat Enterprise Linux AI
    • Automation

      • Red Hat Ansible Automation Platform
      • Red Hat Ansible Lightspeed
    • Developer tools

      • Red Hat Trusted Software Supply Chain
      • Podman Desktop
      • Red Hat OpenShift Dev Spaces
    • Developer Sandbox

      Developer Sandbox
      Try Red Hat products and technologies without setup or configuration fees for 30 days with this shared Openshift and Kubernetes cluster.
    • Try at no cost
  • Technologies

    Featured

    • AI/ML
      AI/ML Icon
    • Linux
      Linux Icon
    • Kubernetes
      Cloud icon
    • Automation
      Automation Icon showing arrows moving in a circle around a gear
    • View All Technologies
    • Programming Languages & Frameworks

      • Java
      • Python
      • JavaScript
    • System Design & Architecture

      • Red Hat architecture and design patterns
      • Microservices
      • Event-Driven Architecture
      • Databases
    • Developer Productivity

      • Developer productivity
      • Developer Tools
      • GitOps
    • Secure Development & Architectures

      • Security
      • Secure coding
    • Platform Engineering

      • DevOps
      • DevSecOps
      • Ansible automation for applications and services
    • Automated Data Processing

      • AI/ML
      • Data Science
      • Apache Kafka on Kubernetes
      • View All Technologies
    • Start exploring in the Developer Sandbox for free

      sandbox graphic
      Try Red Hat's products and technologies without setup or configuration.
    • Try at no cost
  • Learn

    Featured

    • Kubernetes & Cloud Native
      Openshift icon
    • Linux
      Rhel icon
    • Automation
      Ansible cloud icon
    • Java
      Java icon
    • AI/ML
      AI/ML Icon
    • View All Learning Resources

    E-Books

    • GitOps Cookbook
    • Podman in Action
    • Kubernetes Operators
    • The Path to GitOps
    • View All E-books

    Cheat Sheets

    • Linux Commands
    • Bash Commands
    • Git
    • systemd Commands
    • View All Cheat Sheets

    Documentation

    • API Catalog
    • Product Documentation
    • Legacy Documentation
    • Red Hat Learning

      Learning image
      Boost your technical skills to expert-level with the help of interactive lessons offered by various Red Hat Learning programs.
    • Explore Red Hat Learning
  • Developer Sandbox

    Developer Sandbox

    • Access Red Hat’s products and technologies without setup or configuration, and start developing quicker than ever before with our new, no-cost sandbox environments.
    • Explore Developer Sandbox

    Featured Developer Sandbox activities

    • Get started with your Developer Sandbox
    • OpenShift virtualization and application modernization using the Developer Sandbox
    • Explore all Developer Sandbox activities

    Ready to start developing apps?

    • Try at no cost
  • Blog
  • Events
  • Videos

Enhance Ansible development experience with Lightspeed

August 22, 2023
Himanshu Yadav
Related topics:
Artificial intelligenceAutomation and management
Related products:
Red Hat Ansible Automation Platform

Share:

    Ansible Lightspeed is a generative AI tool that provides an efficient way for developers to create Ansible content and automation tasks for Ansible playbooks. In this article, we will explore how to install and use Ansible Lightspeed in Visual Studio Code. This makes it easy to create Ansible content; you can simply type in plain English descriptions and Ansible Lightspeed will generate the code recommendations for you.

    Prerequisites

    Before proceeding through this tutorial, make sure you have installed the following:

    • Visual Studio Code (VS Code)
    • Python 3.9+
    • Ansible Automation Platform 2.x (see How to install Ansible Automation Platform 2.4 on RHEL 9.1).

    1. Install Ansible extension in VS Code

    The Ansible extension offers intelligent code completion, syntax highlighting, and error checking for YAML and Ansible-specific files. The extension allows users to execute Ansible tasks and playbooks directly from the editor and view the real-time output. With built-in support for Ansible Vault and Galaxy, developers can efficiently manage secrets and access a vast library of community-contributed roles.

    1. In VS Code, click the extension icon in the left menu. In the search field, type Ansible to bring up the Ansible extension by Red Hat.

    2. Click the Install button. 
    3. After installing the Ansible extension in the integrated development environment (IDE), click on the little gear icon beside the Install button and select the Extension Setting option, as illustrated in Figure 1.
    Vs code extention
    Figure 1: Installing the Ansible extension in Visual Studio Code.

    2. Enable Ansible Lightspeed in VS Code

    You will get the following settings page of Ansible Extension, from which you can make changes to execution environment image, container registry, Ansible lint, and many more. This article only covers Lightspeed, so we will just enable the Ansible Lightspeed option and Ansible Lightspeed with Watson Code Assistant inline suggestions. Please refer to Figure 2 to set the configuration.

    enable it
    Figure 2: Enable Lightspeed and Watson Code Assistant.

    Note: If you get the error "Ansible-lint is missing," use the following commands to install it. There are two methods to install: pip and dnf.

    1. Install using pip:
      pip3 install ansible-lint
    1. Install with the dnf package manager:
      dnf install ansible-lint

    3. Authenticate Lightspeed with GitHub

    Click on the Ansible extension icon on the left bar. You will see the Connect button, as shown in Figure 3.

    connect
    Figure 3: Connect Ansible to authenticate.

    It will redirect to your default browser and open the GitHub login page. 

    Ansible Lightspeed requires GitHub authentication. Sign in using your GitHub credentials and follow the prompts. Once done, you will be redirected to VS Code and the Connect button should now be replaced with your GitHub ID.

    4. Validate Ansible Lightspeed

    On the bottom-right corner, you should see Lightspeed (Figure 4). Ansible Lightspeed is ready for you to write playbooks.

    lightspeed
    Figure 4: Lightspeed reflected on Visual Studio Code.

    5. How to trigger Ansible Lightspeed

    Lightspeed will recommend context based on the text you type in the name field in the playbook section. Once you hit the Enter key, you will get the suggestion as faded text. Hit the Tab key if everything looks good to you.

    The first example is "Installing Minikube on an RHEL server." To generate a playbook (Figure 5), make sure you have the format of the playbook as shown below, like defining hosts, permissions of become value, and so on:

    - name: Lightspeed_demo
      hosts: rhel
      become: true
    
      tasks:
        - name: Install apache httpd server and enable it
          ansible.builtin.package:
            name: httpd
            state: present
    
        - name: Install minikube on rhel server
          ansible.builtin.package:
            name:
              https://storage.googleapis.com/minikube/releases/latest/minikube-latest.x86_64.rpm
            state: present
    playbook-1
    Figure 5: Trigger Ansible Lightspeed to generate the playbook.

    The second example is installing the kubectl and oc command-line interface (CLI) tools on a server. As in the previous example, we are defining topics about requirements in the name field, Ansible Lightspeed is generating and suggesting to us the context of Ansible playbook. If you are fine with the suggestion, press the Tab key to accept.

    - name: Lightspeed_demo
      hosts: rhel
      become: true
    
      tasks:
        - name: Include redhar.rhel_system_roles.cockpit
          ansible.builtin.include_role:
                name: redhar.rhel_system_roles.cockpit
    
        - name: Install apache httpd server and enable it
          ansible.builtin.package:
            name: httpd
            state: present
    
        - name: Install minikube on rhel server
          ansible.builtin.package:
            name:
              https://storage.googleapis.com/minikube/releases/latest/minikube-latest.x86_64.rpm
            state: present
    
        - name: Install oc & kubectl
          ansible.builtin.package:
            name: "{{ item }}"
            state: present
          loop:
            - https://mirror.openshift.com/pub/openshift-v4/clients/ocp/latest/openshift-client-linux.rpm
            - kubectl
            - atomic-openshift-utils
    
        - name: Install and start the openshift CRC cluster on my rhel machine
          ansible.builtin.command:
            cmd: /usr/local/bin/oc adm ctnplc -n openshift-cluster-api -l k8s-app=openshift-cluster-api
            chdir: /home/ano-user/openshift-cluster-api
    playbook-2
    Figure 6: Red Hat OpenShift Local cluster install using Ansible Lightspeed.

    Lightspeed also provides source code recommendations in the debugging window beside the terminal. It shows more information if you extend it, as shown in Figure 7.

    lightspeed source
    Figure 7: Ansible Lightspeed code recommendation sources.  

    Continue your automation journey with Ansible Automation Platform

    Get started with Ansible Automation Platform by exploring interactive hands-on labs. Download Ansible Automation Platform at no cost and begin your automation journey today.

    Last updated: September 28, 2023

    Related Posts

    • The benefits of deploying Ansible Automation Platform on AWS

    • How to use Ansible Automation Platform from Azure Marketplace

    • How to create an EC2 instance in AWS using Ansible automation

    • How to deploy apps in a K8s cluster via automation controller

    • How to install Microsoft SQL on RHEL using ansible-navigator

    • How to deploy a MSSQL database using Ansible Vault

    Recent Posts

    • Supercharging AI isolation: microVMs with RamaLama & libkrun

    • Simplify multi-VPC connectivity with amazon.aws 9.0.0

    • How HaProxy router settings affect middleware applications

    • Fly Eagle(3) fly: Faster inference with vLLM & speculative decoding

    • Kafka Monthly Digest: June 2025

    What’s up next?

    Discover how automation at the edge can help your organization improve scalability, security, agility, and overall efficiency. This e-book describes seven use cases and examples demonstrating automation at the edge of the network.

    Get the e-book
    Red Hat Developers logo LinkedIn YouTube Twitter Facebook

    Products

    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform

    Build

    • Developer Sandbox
    • Developer Tools
    • Interactive Tutorials
    • API Catalog

    Quicklinks

    • Learning Resources
    • E-books
    • Cheat Sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site Status Dashboard
    • Report a security problem

    RED HAT DEVELOPER

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit
    © 2025 Red Hat

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility

    Report a website issue