Validating
Show the inventory
Run the following command to show the inventory:
ansible-inventory --list --yaml
Note
Notice how the variables are inherited from the parent groups.
all:
children:
ungrouped:
hosts:
webserver1:
web_color: green #(1)!
webserver3:
web_color: orange #(2)!
webserver:
hosts:
webserver2:
web_color: blue #(3)!
- This variable was defined for the host
webserver1
directly - This variable was defined in the group
all
and inherited by the hostwebserver3
- This variable was defined in the group
webserver
and inherited by the hostwebserver2
all:
hosts:
webserver1:
web_color: "green"
webserver2:
webserver3:
vars:
web_color: "orange"
children:
webserver:
vars:
web_color: "blue"
hosts:
webserver2: