1

I am currently working on some ansible automation tasks and wanted to use ansible facts in a role I created. However, I cannot access any facts.
Example: If I want to use the default IP-Address of a Windows machine, I was advised to use the following variable:

{{ ansible_default_ipv4.address }}

Ansible however tells me, that this variable is not defined.

Does anyone have an idea as to how I should use facts in a role?

Tyler2P
  • 2,324
  • 26
  • 22
  • 31
ActualChipmunk
  • 35
  • 1
  • 1
  • 4

1 Answers1

1

try this one: {{ hostvars[host].ansible_default_ipv4.address }}

Roman Zinger
  • 102
  • 2
  • 9