Foundations of Ansible

Explore essential Ansible concepts, terminology, and tools, then set up your environment to start writing  your first Ansible playbook.

Start your Ansible Automation Platform Trial

Integrated developer environments (IDEs) can help us write code faster and more efficiently. They provide several features such as code auto-completion, syntax highlighting, debugging tools and many more. Next, we will walk you through the basic steps to install and configure Visual Studio Code, a popular source code editor.

In this lesson, you will:

  • Learn about Visual Studio Code, installation, customization, and navigation.

What is Visual Studio Code

Visual Studio Code (VS Code) is a popular source code editor that runs on your desktop and is available for Windows, macOS, and Linux.

VS Code supports extensions, including the Ansible VS Code extension, that introduce additional features and functionality for writing Ansible code. Other popular extensions include additional language support, debuggers, themes, and productivity tools.

VS Code provides integrated support for Git, which will be for version control of your code and is widely used for managing Ansible playbooks, roles, and more.

How to download and install VS Code

To download and install VSCode, visit the Visual Studio Code website. We also have a learning path to teach you more about the Ansible Visual Studio Code extension.

Navigating Visual Studio Code

The user interface for VS Code includes the following (see Figure 1):

  1. An editor area where you will write and edit your code. 
  2. The sidebar which provides access to various functionalities such as file navigation, search, source control, and extensions. 

    User interface for VS Code
  3. The status bar displays information about the current file, project, and other helpful shortcuts.
  4. The command palette allows you to access all of VS Code's functionalities through keyboard shortcuts.
Figure shows settings.json of Visual Studio Code.
Figure 1: Visual Studio Code settings.

To create a new file, select File -> New File from the menu or by using the shortcut Ctrl + N (Cmd + N on macOS).

VS Code also provides features like syntax highlighting, auto-indentation, and bracket matching to ensure your code is well-structured and readable.

Customization

VS Code offers extensive customization options to personalize your development environment. You can customize settings such as themes, keybindings, and editor preferences by accessing File > Preferences > Settings or by using the shortcut Ctrl + , (Cmd + , on macOS).

Additional resources:

Previous resource
Introduction to Git and GitHub
Next resource
Setting up your development environment