AnsibleUndefinedVariable: ‘ansible.vars.hostvars.HostVarsVars object’ has no attribute ‘my_var’

ansible -i inventory all -m debug -a "var=hostvars[inventory_hostname].ansible_host"
ansible -i inventory all -m debug -a "var=hostvars[inventory_hostname].ansible_host" | grep -B1 "NOT DEFINED"




Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

My Favorite JavaScript Interview Questions

A new dead simple open source Web Component to lazy load images

Flexbox CSS

Adventures with NPM — Transitioning to Yarn

Passing ref to another component (React + TypeScript)

Swagger with typescript based Express.js(Node) application.

Top React Hooks — Clipboard, APIs, and Forms

Lesser Known Facts About JavaScript

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Pedro Gomes

Pedro Gomes

More from Medium

Automation of domain expiration checking with prometheus-stack in Kubernetes

Provision a Single-node Kubernetes Cluster using Ansible on Ubuntu 20.04

Letting VMs talk to Kubernetes

Getting Started VMware Tanzu Community Edition (Part 3)