Skip to content

A script that will scrape a ansible inventory and build a graph representation for that inventory.

License

Notifications You must be signed in to change notification settings

jenmud/ansible-graph

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ansible-graph

A script that will scrape a Ansible inventory or playbook and build a dependency graph representation.

This is still a work in progress!

TO DO

  • Resolve the includes and variables.
  • Link hosts and groups to a role
  • Get roles variables
  • Get template files for a role
  • Get files for a role
  • Add in tests!!

Installing and Developing

Fork the project and clone it

# Assuming that you have forked the repo
$ git clone https://github.com/<username>/ansible-graph.git

Clone ansible examples

$ git clone https://github.com/ansible/ansible-examples.git

Get it installed using a python virtualenv

$ virtualenv ansible-graph-ve
$ ansible-graph-ve/bin/pip install -U pip setuptools wheel
$ ansible-graph-ve/bin/pip install ansible-graph  # use -e to do a develop install.

Running a scrape and starting a webserver

$ ansible-graph-ve/bin/ansible-graph --runserver -i ansible-examples/*/hosts -p ansible-examples/*/playbooks/*.yml
INFO:root:Updated ansible loader basedir to '/Volumes/Data/Programming/Repos'
INFO:root:Starting server 0.0.0.0:8000
INFO:ruruki_eye.server:Setting up db to <ruruki.graphs.Graph object at 0x10df1b150>
INFO:werkzeug: * Running on http://0.0.0.0:8000/ (Press CTRL+C to quit)

Open a web browser and navigate to the running address provided in the output above.

http://0.0.0.0:8080

Example of interesting output (assuming that vertice with name=mongo1 has the id 19)

http://localhost:8000/vertices/19?levels=1

Screenshot

About

A script that will scrape a ansible inventory and build a graph representation for that inventory.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages