{"id":13503301,"url":"https://github.com/ansible/vscode-ansible","last_synced_at":"2026-01-21T19:03:10.310Z","repository":{"id":37040324,"uuid":"325286676","full_name":"ansible/vscode-ansible","owner":"ansible","description":"vscode/vscodium extension for providing Ansible auto-completion and integrating quality assurance tools like ansible-lint, ansible syntax check, yamllint, molecule and ansible-test.","archived":false,"fork":false,"pushed_at":"2025-05-12T16:17:45.000Z","size":46187,"stargazers_count":418,"open_issues_count":115,"forks_count":103,"subscribers_count":17,"default_branch":"main","last_synced_at":"2025-05-12T16:27:33.297Z","etag":null,"topics":["ansible-dev-tools","ansible-language-server","ansible-lint","hack","hacktoberfest","lsp","molecule","taskfile","vscode-extension"],"latest_commit_sha":null,"homepage":"https://ansible.readthedocs.io/projects/vscode-ansible/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ansible.png","metadata":{"files":{"readme":"docs/README.md","changelog":"CHANGELOG.md","contributing":"docs/contributing.md","funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-12-29T12:54:23.000Z","updated_at":"2025-05-12T10:49:00.000Z","dependencies_parsed_at":"2023-10-20T07:05:48.352Z","dependency_job_id":"b0a3d885-f7be-4956-89f8-0f8d25dac70b","html_url":"https://github.com/ansible/vscode-ansible","commit_stats":{"total_commits":1448,"total_committers":57,"mean_commits":"25.403508771929825","dds":0.6284530386740331,"last_synced_commit":"460e52a5e9e8b9221ff8add9b48371d19b15fbb1"},"previous_names":[],"tags_count":61,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ansible%2Fvscode-ansible","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ansible%2Fvscode-ansible/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ansible%2Fvscode-ansible/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ansible%2Fvscode-ansible/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ansible","download_url":"https://codeload.github.com/ansible/vscode-ansible/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254518383,"owners_count":22084374,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ansible-dev-tools","ansible-language-server","ansible-lint","hack","hacktoberfest","lsp","molecule","taskfile","vscode-extension"],"created_at":"2024-07-31T22:02:45.444Z","updated_at":"2026-01-21T19:03:10.277Z","avatar_url":"https://github.com/ansible.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# Ansible VS Code Extension\n\nThe Ansible extension for Visual Studio Code streamlines Ansible development by\nproviding an integrated, feature-rich environment tailored for automation\nworkflows. It offers features such as syntax highlighting, linting, intelligent\ncode completion, and AI-assisted suggestions via Ansible Lightspeed.\n\nWith support for multi-root workspaces, containerized execution environments,\nand extensive configuration options, the extension enhances productivity and\nensures consistent code quality for both individual and team-based projects.\nThis extension adds language support for Ansible in\n[Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=redhat.ansible)\nand [OpenVSX](https://open-vsx.org/extension/redhat/ansible) by using the\n[ansible-language-server](als/README.md).\n\n## Installation Requirements\n\nBefore you begin, make sure your system has:\n\n- The [`ansible-dev-tools`](https://github.com/ansible/ansible-dev-tools) python\n  package\n- A supported version of\n  [`ansible-core`](https://docs.ansible.com/ansible/latest/reference_appendices/release_and_maintenance.html)\n- Optionally, a `devcontainer.yaml` file to develop in a devcontainer\n  eliminating the need to install and manage python versions and packages.\n\n\u003e Note: On Windows, use with the Remote - WSL or Remote - Containers extensions\n\u003e for optimal compatibility.\n\n## Manual Extension Activation\n\nIt is recommended to open a folder containing Ansible files with a VS Code\nworkspace.\n\n![Linter support](https://raw.githubusercontent.com/wiki/ansible/vscode-ansible/images/activate-extension.gif)\n\nNote:\n\n- For Ansible files open in an editor window ensure the language mode is set to\n  `Ansible` (bottom right of VS Code window).\n- The runtime status of extension should be in activate state. It can be\n  verified in the `Extension` window `Runtime Status` tab for `Ansible`\n  extension.\n\n## Getting Started\n\n### Welcome Page\n\nThe extension provides a comprehensive Welcome Page that serves as a dashboard\nfor Ansible development tools. Access it as follows:\n\n- Open the Command Palette (Ctrl+Shift+P or Cmd+Shift+P)\n- Type \"Open Ansible Development Tools menu\" and selecting it.\n\n  **OR**\n\n- From the Quick Links panel, click **Getting Started**.\n\n  - The walkthroughs will appear on the right-hand side.\n\n### Interactive Walkthroughs\n\nThe extension offers guided walkthroughs to help you quickly get started with\nAnsible development using step-by-step instructions.\n\n#### Create an Ansible Environment\n\nLearn how to create a new Ansible playbook, configure the environment using the\nstatus bar, and install the necessary Ansible packages to get set up.\n\n#### Start Automating with Your First Ansible Playbook\n\nThis walkthrough guides you through enabling Ansible Lightspeed, creating a\nplaybook project, writing your first playbook, and saving it within the project\nstructure.\n\n#### Discover Ansible Development Tools\n\nExplore the full range of Ansible development tools available in the extension,\nincluding scaffolding content, testing, and deployment guidance for your\nautomation journey.\n\n### Quick Links\n\nThe Quick Links panel provides easy access to common Ansible tasks and is\navailable in the Ansible sidebar view. It can be accessed by clicking on the\nAnsible extension icon and includes:\n\n#### Launch Section\n\nThis section provides quick access to:\n\n- Getting Started: Opens the Ansible Development Tools welcome page\n- Ansible code bot: Documentation for the AI-powered code assistant\n- Documentation: Links to Ansible Development Tools documentation\n- Settings: Quick access to extension settings\n\n#### Initialize Section\n\nThis section helps you create new Ansible projects:\n\n- Collection project: Create a new Ansible collection\n- Execution environment project: Set up a new execution environment\n- Playbook project: Create a new Ansible playbook project\n\n#### Add Section\n\nThis section allows you to add resources to existing projects:\n\n- Collection plugin: Add a plugin to an existing collection\n- dev container: Create a dev container configuration\n- Devfile: Create a devfile for development environments\n- Execution environment template: Create an execution environment file\n- Role: Add a role to an existing collection\n- Playbook: Generate a playbook with Ansible Lightspeed\n\n## Using Dev Containers\n\nThis extension supports generating dev containers to provide isolated,\nconsistent Ansible development environments in VS Code. The\n[Microsoft Dev Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers)\nis required for this feature. See the\n[Ansible Development Tools (ADT)- Execution Environment documentation](https://ansible.readthedocs.io/projects/dev-tools/container/)\nfor more information on what is included in the generated dev container.\n\n### Create a dev container\n\nQuick Links Panel: Go to Ansible sidebar → click dev container\n\nCommand Palette: Ctrl+Shift+P → search \"Ansible: Create a dev container\"\n\n### Configuration Options\n\nChoose image:\n\n- Upstream: ghcr.io/ansible/community-ansible-dev-tools:latest\n\n- Downstream: registry.redhat.io/.../ansible-dev-tools-rhel8:latest\n\nSet destination and overwrite options in the webview, and click \"Create\".\n\n### Open workspace in the dev container\n\nCommand Palette: Ctrl+Shift+P → search \"Dev Containers: Reopen in container\"\n\nSelect the dev container file that matches your desired container engine.\n\nThe workspace will reopen in a container with all the Ansible Development Tools\n(ADT) installed.\n\n## Ansible Lightspeed\n\nThe extension integrates with Ansible Lightspeed with watsonx Code Assistant to\nprovide AI-powered features. Lightspeed provides inline code suggestions as you\ntype:\n\n- Press Ctrl+. to trigger suggestions\n- Press Tab to accept a suggestion\n- Press Escape to hide a suggestion\n\nSee the guide\n[here](https://docs.redhat.com/en/documentation/red_hat_ansible_lightspeed_with_ibm_watsonx_code_assistant/2.x_latest/html/red_hat_ansible_lightspeed_with_ibm_watsonx_code_assistant_user_guide/set-up-lightspeed_lightspeed-user-guide#set-up-lightspeed_lightspeed-user-guide)\nto get started.\n\n## Content Creation Tools\n\nThe extension provides webview-based interfaces for creating and scaffolding\nAnsible content.\n\n### Creating Collections\n\nYou can create a new Ansible collection with a structured layout including:\n\n- Basic collection metadata\n- Directory structure for plugins, modules, and roles\n- Documentation templates\n- Test framework setup\n\nTo create a collection:\n\n- Click \"Collection project\" in the Quick Links panel\n- Enter the namespace and collection name\n- Specify the destination directory\n- Click \"Create\"\n\n### Creating Playbooks\n\nThe extension offers multiple ways to create playbooks:\n\n### Empty Playbook\n\n- Use the command \"Ansible: Create an empty Ansible playbook\"\n- Edit the playbook manually\n\n### AI-Generated Playbook (with Ansible Lightspeed)\n\n- Use the command \"Ansible Lightspeed: Playbook generation \"\n- Describe what you want the playbook to do\n- Review and customize the generated playbook\n\n### Playbook Project\n\n- Use the command \"Ansible: Create New Playbook Project\"\n- Enter the namespace and collection name\n- Specify the destination directory\n\nA complete project structure will be created with playbooks, inventory, and\nconfiguration files\n\n### Creating Execution Environments\n\nYou can create execution environment configurations for containerized Ansible\nenvironments:\n\n1. Click \"Execution environment project\" in the Quick Links panel\n\n2. Configure: Base image, Collections to include, System packages, Python\n   packages\n\n3. Click \"Create\" to generate the execution environment file\n\n## Ansible Language Files\n\nThe extension works when a document is assigned the Ansible language. Files are\nautomatically recognized as 'Ansible' in these cases:\n\n### Without file inspection\n\n- yaml files under `/playbooks` dir.\n- files with the following double extension: `.ansible.yml` or `.ansible.yaml`.\n- notable yaml names recognized by ansible like `site.yml` or `site.yaml`\n- yaml files having playbook in their filename: `*playbook*.yml` or\n  `*playbook*.yaml`\n\nAdditionally, in VS Code, you can add persistent file association for language\nto `settings.json` file like this:\n\n```json\n{\n  ...\n\n  \"files.associations\": {\n    \"*plays.yml\": \"ansible\",\n    \"*init.yml\": \"yaml\",\n  }\n}\n```\n\n### File inspection for Ansible keywords\n\n- Primary method is inspection for top level playbook keywords like 'hosts',\n  'import_playbook' and 'ansible.builtin.import_playbook' in yaml files.\n\n### Modelines (optional)\n\n- The extension also supports the usage of\n  [modelines](https://vim.fandom.com/wiki/Modeline_magic) and when used, it is\n  given highest priority and language is set according to modelines. Example and\n  syntax of modelines:\n\n```yaml\n# code: language=ansible\nor\n# code: language=yaml\n```\n\nRest all the .yml, or .yaml files will remain yaml by default unless the user\nexplicitly changes the language to ansible for which the process is mentioned\nbelow.\n\n## Ansible Language Features\n\n### Syntax highlighting\n\nThe extension provides distinct highlighting for:\n\n- Ansible keywords\n- Module names and options\n- YAML elements\n- Jinja expressions (even in conditionals like when, failed_when, etc.)\n\n![Syntax highlighting](images/syntax-highlighting.png)\n\n\u003e The screenshots and animations presented in this README have been taken using\n\u003e the One Dark Pro theme. The default VS Code theme will not show the syntax\n\u003e elements as distinctly, unless customized. Virtually any theme other than\n\u003e default will do better.\n\n### Validation\n\n![YAML validation](images/yaml-validation.gif)\n\nWhile you type, the syntax of your Ansible scripts is verified and any feedback\nis provided instantaneously.\n\n### Integration with ansible-lint\n\n![Linter support](images/ansible-lint.gif)\n\nOn opening and saving a document, `ansible-lint` is executed in the background\nand any findings are presented as errors. You might find it useful that\nrules/tags added to `warn_list` (see\n[Ansible Lint Documentation](https://ansible.readthedocs.io/projects/lint/configuring/))\nare shown as warnings instead.\n\n### Smart autocompletion\n\n![Autocompletion](images/smart-completions.gif)\n\nThe extension tries to detect whether the cursor is on a play, block or task\netc. and provides suggestions accordingly. There are also a few other rules that\nimprove user experience:\n\n- the `name` property is always suggested first\n- on module options, the required properties are shown first, and aliases are\n  shown last, otherwise ordering from the documentation is preserved\n- FQCNs (fully qualified collection names) are inserted only when necessary;\n  collections configured with the\n  [`collections` keyword](https://docs.ansible.com/ansible/latest/collections_guide/index.html#simplifying-module-names-with-the-collections-keyword)\n  are honored. This behavior can be disabled in extension settings.\n\n### Auto-closing Jinja expressions\n\n![Easier Jinja expression typing](images/jinja-expression.gif)\n\nWhen writing a Jinja expression, you only need to type `\"{{`, and it will be\nmirrored behind the cursor (including the space). You can also select the whole\nexpression and press `space` to put spaces on both sides of the expression.\n\n### Documentation reference\n\n![Documentation on hover](images/hover-documentation-module.png)\n\nDocumentation is available on hover for Ansible keywords, modules and module\noptions. The extension works on the same principle as `ansible-doc`, providing\nthe documentation straight from the Python implementation of the modules.\n\n### Jump to module code\n\n![Go to code on Ctrl+click](images/go-to-definition.gif)\n\nYou may also open the implementation of any module using the standard _Go to\nDefinition_ operation, for instance, by clicking on the module name while\nholding `ctrl`/`cmd`.\n\n## Data and Telemetry\n\nThe `vscode-ansible` extension collects anonymous [usage data](usage-data.md)\nand sends it to Red Hat servers to help improve our products and services. Read\nour\n[privacy statement](https://developers.redhat.com/article/tool-data-collection)\nto learn more. This extension respects the `redhat.telemetry.enabled` setting,\nwhich you can learn more about at\n\u003chttps://github.com/redhat-developer/vscode-redhat-telemetry#how-to-disable-telemetry-reporting\u003e.\n\n## Known limitations\n\n- The shorthand syntax for module options (key=value pairs) is not supported.\n- Nested module options are not supported yet.\n- Only Jinja expressions inside Ansible YAML files are supported. To enable\n  syntax highlighting for Jinja template files (e.g., .j2), you can install the\n  [Better Jinja extension](https://marketplace.visualstudio.com/items?itemName=samuelcolvin.jinjahtml).\n- Full support for Jinja blocks (e.g., {% for %}, {% if %}) within Ansible YAML\n  files, such as advanced syntax highlighting or autocompletion specific to\n  block structures, is not yet implemented. Basic YAML highlighting will apply\n  within these blocks.\n\n## Contact\n\nWe welcome your feedback, questions and ideas. Learn how to reach us\n[here](https://ansible.readthedocs.io/projects/vscode-ansible/contact/).\n\n## Credit\n\nBased on the good work done by\n[Tomasz Maciążek](https://github.com/tomaciazek/vscode-ansible)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fansible%2Fvscode-ansible","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fansible%2Fvscode-ansible","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fansible%2Fvscode-ansible/lists"}