Ansible
Check for existing issues
- [X] Completed
Language
ansible / YAML
Tree Sitter parser link
https://github.com/ikatyang/tree-sitter-yaml
Language server link
https://github.com/redhat-developer/yaml-language-server
Misc notes
Would like to see ansible / YAML supported.
Lack of ansible support is the only reason that is holding me back from using Zedd as my full time code editor
Ansible is usually done with Jinja templates, so this probably belongs here:
- Tree Sitter for Jinja2: https://github.com/dbt-labs/tree-sitter-jinja2
- An up-to-date VIM Grammars for Jinja2: https://github.com/Glench/Vim-Jinja2-Syntax
+1. We do not use Ansible but mostly YAML + Jinja and Zed is a little unusable for that right now.
+1
Would be nice to be capable of to provide which LSP must be used. Taking just a few examples from https://www.schemastore.org/api/json/catalog.json, for instance YAML files.
There are many ways that we should be capable of to do so:
- By providing the magic comment
yaml-language-serveran entire set of options could be used.
# yaml-language-server: $schema=https://json.schemastore.org/yamllint.json
---
extends: default
yaml-files: ["*.yaml", "*.yml", ".yamllint"]
ignore: |
.build/
.github/
vendor/
It would be great if there were a setting, such as the fileMatch option, that could automatically configure the url for the LSP. This feature is currently missing in a few examples below.
- For Docker Compose:
{
"name": "docker-compose.yml",
"description": "The Compose specification establishes a standard for the definition of multi-container platform-agnostic applications",
"fileMatch": [
"**/docker-compose.yml",
"**/docker-compose.yaml",
"**/docker-compose.*.yml",
"**/docker-compose.*.yaml",
"**/compose.yml",
"**/compose.yaml",
"**/compose.*.yml",
"**/compose.*.yaml"
],
"url": "https://raw.githubusercontent.com/compose-spec/compose-spec/master/schema/compose-spec.json"
}
- This applies to language subsets as well, such as Ansible, which is the subject of this issue.
[
{
"name": "Ansible Execution Environment",
"description": "Ansible execution-environment.yml file",
"fileMatch": ["**/execution-environment.yml"],
"url": "https://raw.githubusercontent.com/ansible/ansible-lint/main/src/ansiblelint/schemas/execution-environment.json"
},
{
"name": "Ansible Meta",
"description": "Ansible meta/main.yml file",
"fileMatch": ["**/meta/main.yml"],
"url": "https://raw.githubusercontent.com/ansible/ansible-lint/main/src/ansiblelint/schemas/meta.json"
},
{
"name": "Ansible Meta Runtime",
"description": "Ansible meta/runtime.yml file",
"fileMatch": ["**/meta/runtime.yml"],
"url": "https://raw.githubusercontent.com/ansible/ansible-lint/main/src/ansiblelint/schemas/meta-runtime.json"
},
{
"name": "Ansible Argument Specs",
"description": "Ansible meta/argument_specs.yml file",
"fileMatch": ["**/meta/argument_specs.yml"],
"url": "https://raw.githubusercontent.com/ansible/ansible-lint/main/src/ansiblelint/schemas/role-arg-spec.json"
},
{
"name": "Ansible Requirements",
"description": "Ansible requirements file",
"fileMatch": ["requirements.yml"],
"url": "https://raw.githubusercontent.com/ansible/ansible-lint/main/src/ansiblelint/schemas/requirements.json"
},
{
"name": "Ansible Vars File",
"description": "Ansible variables File",
"fileMatch": [
"**/vars/*.yml",
"**/vars/*.yaml",
"**/defaults/*.yml",
"**/defaults/*.yaml",
"**/host_vars/*.yml",
"**/host_vars/*.yaml",
"**/group_vars/*.yml",
"**/group_vars/*.yaml"
],
"url": "https://raw.githubusercontent.com/ansible/ansible-lint/main/src/ansiblelint/schemas/vars.json"
},
{
"name": "Ansible Tasks File",
"description": "Ansible tasks file",
"fileMatch": [
"**/tasks/*.yml",
"**/tasks/*.yaml",
"**/handlers/*.yml",
"**/handlers/*.yaml"
],
"url": "https://raw.githubusercontent.com/ansible/ansible-lint/main/src/ansiblelint/schemas/ansible.json#/$defs/tasks"
},
{
"name": "Ansible Playbook",
"description": "Ansible playbook files",
"fileMatch": [
"playbook.yml",
"playbook.yaml",
"site.yml",
"site.yaml",
"**/playbooks/*.yml",
"**/playbooks/*.yaml"
],
"url": "https://raw.githubusercontent.com/ansible/ansible-lint/main/src/ansiblelint/schemas/ansible.json#/$defs/playbook"
},
{
"name": "Ansible Rulebook",
"description": "Ansible rulebook files",
"fileMatch": ["**/rulebooks/*.yml", "**/rulebooks/*.yaml"],
"url": "https://raw.githubusercontent.com/ansible/ansible-rulebook/main/ansible_rulebook/schema/ruleset_schema.json"
},
{
"name": "Ansible Inventory",
"description": "Ansible inventory files",
"fileMatch": ["inventory.yml", "inventory.yaml"],
"url": "https://raw.githubusercontent.com/ansible/ansible-lint/main/src/ansiblelint/schemas/inventory.json"
},
{
"name": "Ansible Collection Galaxy",
"description": "Ansible Collection Galaxy metadata",
"fileMatch": ["galaxy.yml"],
"url": "https://raw.githubusercontent.com/ansible/ansible-lint/main/src/ansiblelint/schemas/galaxy.json"
},
{
"name": "Ansible-lint Configuration",
"description": "Ansible-lint Configuration",
"fileMatch": [".ansible-lint", "**/.config/ansible-lint.yml"],
"url": "https://raw.githubusercontent.com/ansible/ansible-lint/main/src/ansiblelint/schemas/ansible-lint-config.json"
},
{
"name": "Ansible Navigator Configuration",
"description": "Ansible Navigator Configuration",
"fileMatch": [
".ansible-navigator.json",
".ansible-navigator.yaml",
".ansible-navigator.yml",
"ansible-navigator.json",
"ansible-navigator.yaml",
"ansible-navigator.yml"
],
"url": "https://raw.githubusercontent.com/ansible/ansible-navigator/main/src/ansible_navigator/data/ansible-navigator.json"
}
]
Finally, you can change the language manually through the user interface by selecting the language from the bottom bar or accessing the command palette and toggling the language from there.
VSCode does all that, please double check modelines and file association with ansible-language-server for the Ansible LSP docs
Any updates?
When we can see this implemented on new version of Zed ?
https://github.com/ArcherHume/jinja2-support
There is an Ansible extension available now: https://github.com/kartikvashistha/zed-ansible