Here we have a code example of a sample etc Ansible hosts file.
This is using the INI format.
Notice that we're using square brackets to denote host groups,
my web servers for example.
A host‑level variable would be in this example,
you can see the actual DNS host name, db1 example.com.
And then it's communicating with Ansible on a different.port, as you can see.
There are a number of built‑in variables.
You can look in the Ansible documentation.
You'll come to know a number of them as we go along with this training.
Here's an example of a host‑level variable that exists within a group.
So you want to be careful to keep the inventory file as
simple as possible because it can be harder to troubleshoot
and isolate where a problem shows up.
For instance,
if you're surfacing variables at the host level within one group
and then a group level variable somewhere else,
it can be kind of a nightmare to troubleshoot.
And that is actually a potential issue to be concerned with,
especially if you're an experienced Windows sys admin.
That configuration of the Ansible inventory and actually all
of Ansible comes down to these text files,
which is comfortable for you.
If you're a macOS or Linux user, you're familiar with text files.
But this is something we largely gave up in Windows many years ago.
Lastly, notice this slide shows an example of nesting groups.
So you can get really flexible and creative in how
you're organizing your inventory.
And you can have just a single global inventory on a control node, or you
can use multiple and just specify at the playbook level,
for example, which inventory is being targeted.