The better Ansible vscode extension

The better Ansible vscode extension

I edit my Ansible configuration, which resides in a GitHub repository, with Visual Studio Code. When searching for ansible in the extensions tab a lot of smaller single purpose extension show up and one extension just called Ansible published by Microsoft itself. Since Visual Studio Code is from Microsoft and they should have the resources to develop such an extension, I installed it immediately two years ago when I started using vscode for my Ansible development. It has syntax highlighting, basic YAML validation and some code snippets. But since then, nothing happened, the extensions seems to be abandoned.

Last month when installing vscode on my new computer I searched for an alternative but could not find one directly. Then I came across Red Hat's YAML extension and thought to myself at least I would get better YAML validation. But this extension does much more. It includes schema validation support from https://www.schemastore.org/ and it just so happens that Ansible Roles / Playbooks and other stuff is includes in the schema store.

So now I get solid YAML validation which already found dozens of errors in my syntax that the Ansible extension just overlooked and I also get great Ansible validation and I can hover over options to get short explanations of its usage.

I encountered one or two errors in the extension or more specific in the schema from the schema store, where the validation tells me I'm using the wrong type, but this should only be a matter of time, before the already opened Issue fixes the schema.

Lastly the extension also offers YAML format on save support which is always nice to have.

Update 22.02.2021: The Twitter user and Redhat employee https://twitter.com/sbarnea pointed me to a new Ansible extension he is currently developing and just released the first version of. Next to YAML verification, it also integrates with ansibe-lint. Currently there ist no WSL Support which I would need, but it looks promising. Check it out here:

Ansible Language - Visual Studio Marketplace
Extension for Visual Studio Code - Reports problems identified by ansible-lint, yamllint.