Node discovery with magic variables
We have looked at user-defined variables as well as system data, that is, facts. In addition to these, there are a few variables that define the meta information about the nodes, inventory, and plays, for example, which groups a node belongs to, what groups are part of the inventory, which nodes belong to which group, and so on. These variables, which are implicitly set, are called magic variables, and are very useful for discovering nodes and topology information. The following table lists the most useful magic variables, and their description:
Magic Variable |
Description |
---|---|
|
These are lookup variables or facts set on another host. |
|
This is the list of groups in the inventory. This can be used to walk over a group of nodes to discover its topology information. |
|
This is the list of groups that the node belongs to. |
|
This is the hostname set in the inventory file. It can be different to the |