{"id":13647326,"url":"https://github.com/willthames/ansible-inventory-grapher","last_synced_at":"2025-04-13T12:47:03.249Z","repository":{"id":15662469,"uuid":"18399889","full_name":"willthames/ansible-inventory-grapher","owner":"willthames","description":null,"archived":false,"fork":false,"pushed_at":"2024-12-12T23:40:03.000Z","size":307,"stargazers_count":450,"open_issues_count":11,"forks_count":46,"subscribers_count":22,"default_branch":"main","last_synced_at":"2025-04-06T09:02:53.308Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/willthames.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-04-03T10:58:04.000Z","updated_at":"2025-03-22T13:31:16.000Z","dependencies_parsed_at":"2025-01-09T23:31:42.084Z","dependency_job_id":"f60397a6-123e-4dda-990e-08790e92f799","html_url":"https://github.com/willthames/ansible-inventory-grapher","commit_stats":{"total_commits":72,"total_committers":11,"mean_commits":6.545454545454546,"dds":"0.38888888888888884","last_synced_commit":"d25fb727b20a6a5222d924be4e1e9c378e64d1c1"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willthames%2Fansible-inventory-grapher","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willthames%2Fansible-inventory-grapher/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willthames%2Fansible-inventory-grapher/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willthames%2Fansible-inventory-grapher/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/willthames","download_url":"https://codeload.github.com/willthames/ansible-inventory-grapher/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248717242,"owners_count":21150387,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T01:03:29.656Z","updated_at":"2025-04-13T12:47:03.223Z","avatar_url":"https://github.com/willthames.png","language":"Python","funding_links":[],"categories":["Ansible DevOps Tools Integration","Tools","others","Python","Recently Updated"],"sub_categories":["Interfaces","Enable Proton in Steam","[Dec 16, 2024](/content/2024/12/16/README.md)"],"readme":"## Summary\nansible-inventory-grapher creates a dot file suitable for use by\ngraphviz\n\nRequires:\n* ansible\n* graphviz\n\n[![PyPI version](https://img.shields.io/pypi/v/ansible-inventory-grapher.svg)](https://pypi.python.org/pypi/ansible-inventory-grapher)\n[![Build Status](https://travis-ci.org/willthames/ansible-inventory-grapher.svg?branch=master)](https://travis-ci.org/willthames/ansible-inventory-grapher)\n\n## Getting started\n```bash\npip install ansible-inventory-grapher\n```\n\n## Usage\n```\nUsage: ansible-inventory-grapher [options] pattern1 [pattern2...]\n\nOptions:\n  --version             show program's version number and exit\n  -h, --help            show this help message and exit\n  -i INVENTORY          specify inventory host file [/etc/ansible/hosts]\n  -d DIRECTORY          Location to output resulting files [current directory]\n  -o FORMAT, --format=FORMAT\n                        python format string to name output files (e.g.\n                        {}.dot) [defaults to stdout]\n  -q, --no-variables    Turn off variable display in default template\n  -t TEMPLATE           path to jinja2 template used for creating output\n  -T                    print default template\n  -a ATTRIBUTES         include top-level graphviz attributes from\n                        http://www.graphviz.org/doc/info/attrs.html\n                        [rankdir=TB;]\n  --ask-vault-pass      prompt for vault password\n  --vault-password-file=VAULT_PASSWORD_FILE\n                        Location of file with cleartext vault password\n```\n\nUsing the example inventory in https://github.com/willthames/ansible-ec2-example,\nwe can generate the dot files for two of the example web servers using:\n```bash\nbin/ansible-inventory-grapher -i ../ansible-ec2-example/inventory/hosts \\\n  prod-web-server-78a prod-web-server-28a \\\n  -d test --format \"test-{hostname}.dot\"\n```\n\nYou can add the `-a` option to insert a string with graphviz attributes (http://www.graphviz.org/doc/info/attrs.html) to apply to the root level of the graph.  Some fun examples:\n```bash\n# transpose the tree so it grows from left-right instead of top-bottom\n-a \"rankdir=LR;\"\n\n# circular layout, with group nodes shaded grey\n-a \"layout=circo; overlap=false; splines=polyline;\\\n  node [ style=filled fillcolor=lightgrey ]\"\n\n# orthogonal, UML-like inheritance connectors\n-a \"rankdir=LR; splines=ortho; ranksep=2;\\\n  node [ width=5 style=filled fillcolor=lightgrey ];\\\n  edge [ dir=back arrowtail=empty ];\"\n```\n\nYou can replace the default template (which can be seen by passing the `-T` variable to `ansible-inventory-grapher`) with a template file that can be\npassed with the `-t` option.\n\nThe resulting graphs can then be converted to pngs using:\n```bash\nfor f in test/*.dot ; do dot -Tpng -o test/`basename $f .dot`.png $f; done\n```\n\n![Resulting image for prod-web-server-78a](tests/prod-web-server-1a.png)\n\nOr the whole thing can now be done in one pipeline (only works for one pattern) \nstraight to image viewer (imagemagick's display in this example)\n```bash\nbin/ansible-inventory-grapher -i ../ansible-ec2-example/inventory/hosts \\\n  prod-web-server-1a | dot -Tpng | display png:-\n```\n\nThis works with valid Ansible patterns now although only hosts and groups have been tested.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwillthames%2Fansible-inventory-grapher","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwillthames%2Fansible-inventory-grapher","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwillthames%2Fansible-inventory-grapher/lists"}