The effective value of every Ansible variable, per host.

Stop guessing what a variable resolves to. Ansible Var Lens merges group_vars / host_vars with Ansible's precedence and shows you the final value — and where it comes from — right inside VS Code.

VS Marketplace Version Installs License

What it does

Answers the daily question — "what is the final value of this variable for host X?"

🗂️

Inventory explorer

Activity-bar view of groups and hosts — INI and YAML inventories, multiple files, [group:children], host ranges tolerated.

🎯

Effective vars + provenance

Click a host to see every variable merged with precedence, each annotated with the file it comes from and the files it overrides.

🔍

{{ var }} hovers

Pick a host, then hover any {{ variable }} in playbooks or templates to see its resolved value for that host.

⚖️

Compare two hosts

Diff two hosts to see only the variables that differ — changed, only-in-A or only-in-B, with provenance.

🔒

Vault-aware

Fully vault-encrypted files are skipped and reported; inline !vault scalars show as <vaulted>. Never an error.

Zero setup

Reads ansible.cfg or auto-detects ./inventory / ./hosts. No Ansible execution required.

See where every value comes from

One click on a host, and each variable carries its full override chain.

  web-01.yml — effective variables
# from: host_vars/web-01/override.yml
#   overrides: group_vars/all/base.yml
#   overrides: group_vars/web/main.yml
timeout: 90

# from: group_vars/web/main.yml
nginx: true

Diff two hosts

Only the variables whose effective value differs.

  diff: web-01 vs web-02
# changed  (web-01: host_vars/…  |  web-02: group_vars/…)
timeout:
  web-01: 90
  web-02: 60

# only in web-01  (from host_vars/web-01/override.yml)
role_hint: frontend

Merge order modeled

Lowest → highest precedence (Ansible's inventory layer, hash_behaviour=replace).

  1. inventory [group:vars] — parents before children
  2. group_vars/all
  3. group_vars/<group> — parents before children, alphabetical within depth
  4. inline inventory host vars (ansible_host=…)
  5. host_vars/<host> — wins

Role defaults/vars and play vars are out of scope: they belong to plays, not to the inventory layer this extension models.

Install

From the VS Code Marketplace, or the command line:

$ code --install-extension allannava95.ansible-var-lens

Requires VS Code 1.85+. Then open any Ansible repo — the extension activates automatically on ansible.cfg, group_vars/ or host_vars/.