Skip to content

Instantly share code, notes, and snippets.

@loncarales
Created May 26, 2020 21:36
Show Gist options
  • Save loncarales/00202a81f2edd631c1f9ccef578ddcaf to your computer and use it in GitHub Desktop.
Save loncarales/00202a81f2edd631c1f9ccef578ddcaf to your computer and use it in GitHub Desktop.
Ansible Inventory Grapher

Getting started

$ pip install ansible-inventory-grapher

# DOT files are stored in ./graphs folder
$ ansible-inventory-grapher -i hosts.ini -d graphs -o loncar_net.dot --visible-vars=ansible_host --visible-vars=ansible_user loncar_net

# The resulting graphs can then be converted to pngs using this command. Assuming the DOT files are stored in graphs folder
$ for f in graphs/*.dot ; do dot -Tpng -o graphs/`basename $f .dot`.png $f; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment