The preferred practice in Ansible is not to store variables
directly in your main inventory file.
However,
in addition to storing variables directly in an inventory
file, hosting group variables can be stored in individual
files relative to the inventory file.
So you can keep hosting group‑specific variables
separate from the inventory file.
We will discuss this more and also have a demo shortly.
So variables are a key component of Ansible, and they
allow for dynamic play content and reusable plays across
different sets of the inventory.
So variable data, such as specific details and how to connect to
a particular host in your inventory, can be included, along with
the inventory in a variety of ways.
So while Ansible can discover data about systems during the setup
phase, it may be cases not all data can be discovered.
So here, we have the option to define data with the inventory. That
will expand Ansible on what it can already discover.
So with inventories, we can provide more than just system naming and
grouping. Data regarding systems can be passed along as well.
This data could include, for example, host‑specific data to using templates,
group‑specific data to use in task arguments or
conditionals, behavioral parameters that are used to tune
how Ansible interacts with the systems, all of which we will demo very soon.