2

I'm using Ansible Tower trying to create a Smart Inventory based on some Ansible Facts.

What's the syntax required to access the "facts" in a Smart Inventory?

technocrat
  • 3,513
  • 5
  • 25
  • 39

1 Answers1

1

The Ansible Tower documentation is a little mysterious for the: Smart Inventory -> Smart Host Filter -> Dynamic Host.

Ansible Facts: The "Key" button (aka legend/help) in Ansible Tower suggests to use the term "facts" to access Ansible Facts. This is wrong, you need to use "ansible_facts" to access facts.

Examples:

  • Access the facts: ansible_facts.ansible_lsb__major_release:"7"
  • Using Numbers in facts: Numeric values need to be quoted (see above)
  • Double underscores to represent a json 'dot'.

Variables:

  • Variables appear to be stored as an escaped JSON text in a singular field.
  • Smart Inventory of 'Active' Servers: "variables:active".
    • This does a search across ALL fields in the variables, no current way to do the following: "variables.openstack__vm_state:active"
technocrat
  • 3,513
  • 5
  • 25
  • 39