Get started with the Ansible Visual Studio Code extension

Take a guided walkthrough of the Ansible extension for Visual Studio Code (VS Code).

Ansible Lightspeed is the latest offering of Red Hat and IBM which bring the power of generative AI in your Ansible creation experience.

In order to get the full benefit of this lesson, you will need:

  • VS Code and Ansible Development setup done on your workstation.
  • A Red Hat customer portal account (that is attached to your organization) with an active Ansible Automation Platform subscription.
  • An IBM watsonx Code Assistant subscription.

In this lesson, you will:

  • Learn about integration Ansible extension for VS Code with Ansible Lightspeed.

Getting connected: installation and configuration

To enable the Red Hat Ansible Lightspeed service within the extension, follow these steps:

Access the Extension Settings via the gear icon.

Enabling both Ansible Lightspeed enabled and Enable Ansible Lightspeed with Watson Code Assistant inline suggestions checkboxes in the settings. You can enable Red Hat Ansible Lightspeed in the User or Workspace settings, based on your preference. Figure 1 depicts this procedure

Enable Red Hat Ansible Lightspeed in the User or Workspace settings.
Figure 1: Enable Red Hat Ansible Lightspeed in the User or Workspace settings.

Click on the Ansible A in the VS Code activity bar on the left-hand side of your editor to open the extension. Click Connect and follow the prompts to log into your Red Hat account using your credentials.

Next, authorize Ansible Lightspeed for VS Code by clicking Authorize. Follow the browser prompts to redirect you back to VS Code.

Click Open in the VS Code confirmation dialog box (Figure 2).

Figure shows how to log in using Red Hat credentials.
Figure 2: Log in using your Red Hat credentials.
Figure 2: Log in using your Red Hat credentials.

Congratulations! You’ve successfully configured Ansible Lightspeed with watsonx Code Assistant in VS Code. You can confirm that Red Hat Ansible Lightspeed is enabled by checking the VS Code status bar at the bottom of the editor window (Figure 3).

Figure shows VS Code status bar at the bottom of the editor window.
Figure 3: VS Code status bar.
Figure 3: VS Code status bar.

Additional resources: 

Previous resource
Ansible lint integration with the Ansible VS Code extension
Next resource
Execute Ansible playbooks and integrated version control