pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: https://zed.dev/docs/languages/../development/../languages/../ai/../languages/ansible.html

ure Ansible language support in Zed, including language servers, formatting, and debugging."">
Download

Ansible

Support for Ansible in Zed is provided via a community-maintained Ansible extension.

Setup

File detection

To avoid mishandling non-Ansible YAML files, the Ansible Language is not associated with any file extensions by default.

To change this behavior, you can add a "file_types" section to Zed settings inside your project (.zed/settings.json) or your Zed user settings (~/.config/zed/settings.json) to match your folder/naming conventions. For example:

{
  "file_types": {
    "Ansible": [
      "**.ansible.yml",
      "**.ansible.yaml",
      "**/defaults/*.yml",
      "**/defaults/*.yaml",
      "**/meta/*.yml",
      "**/meta/*.yaml",
      "**/tasks/*.yml",
      "**/tasks/*.yaml",
      "**/handlers/*.yml",
      "**/handlers/*.yaml",
      "**/group_vars/*.yml",
      "**/group_vars/*.yaml",
      "**/host_vars/*.yml",
      "**/host_vars/*.yaml",
      "**/playbooks/*.yml",
      "**/playbooks/*.yaml",
      "**playbook*.yml",
      "**playbook*.yaml"
    ]
  }
}

Feel free to modify this list as per your needs.

Inventory

If your inventory file is in the YAML format, you can either:

  • Append the ansible-lint inventory JSON schema to it via the following comment at the top of your inventory file:
# yaml-language-server: $schema=https://raw.githubusercontent.com/ansible/ansible-lint/main/src/ansiblelint/schemas/inventory.json
  • or, configure the YAML language server settings to set this schema for all your inventory files, that match your inventory pattern, under your Zed settings (ref):
{
  "lsp": {
    "yaml-language-server": {
      "settings": {
        "yaml": {
          "schemas": {
            "https://raw.githubusercontent.com/ansible/ansible-lint/main/src/ansiblelint/schemas/inventory.json": [
              "./inventory/*.yaml",
              "hosts.yml"
            ]
          }
        }
      }
    }
  }
}

LSP Configuration

By default, the following configuration is passed to the Ansible language server. It conveniently mirrors the defaults set by nvim-lspconfig for the Ansible language server:

{
  "ansible": {
    "ansible": {
      "path": "ansible"
    },
    "executionEnvironment": {
      "enabled": false
    },
    "python": {
      "interpreterPath": "python3"
    },
    "validation": {
      "enabled": true,
      "lint": {
        "enabled": true,
        "path": "ansible-lint"
      }
    }
  }
}

Note: In order for linting to work, ensure that ansible-lint is installed and discoverable on your $PATH.

When desired, any of the above default settings can be overridden under the "lsp" section of your Zed settings file. For example:

{
  "lsp": {
    // The Zed Ansible extension prefixes all settings with `ansible`
    // so use `ansible.path` instead of `ansible.ansible.path`.
    "ansible-language-server": {
      "settings": {
        "ansible": {
          "path": "ansible"
        },
        "executionEnvironment": {
          "enabled": false
        },
        "python": {
          "interpreterPath": "python3"
        },
        "validation": {
          "enabled": false,
          "lint": {
            "enabled": false,
            "path": "ansible-lint"
          }
        }
      }
    }
  }
}

A full list of options/settings that can be passed to the server can be found at the project's page here.

pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy