Third-party commands
Before we finish looking at the various Ansible commands, let’s look at a command that isn’t shipped as part of Ansible itself but is, in fact, a third-party open source project.
The ansible-inventory-grapher command
The ansible-inventory-grapher
command, by Will Thames, uses the Graphviz library to visualize your host inventories. The first thing we need to do is install Graphviz. To install this on macOS using Homebrew, run the following command:
$ brew install graphviz
To install Graphviz on Ubuntu, use the following command:
$ sudo apt-get install graphviz
Once installed, you can install ansible-inventory-grapher
using pip
:
$ pip install ansible-inventory-grapher
Now that we have everything installed, we can generate the graph using the hosts
file we used earlier in this chapter:
$ ansible-inventory-grapher -i hosts demohosts
This will generate something that looks like this:
Figure 3.23 –...