Skip to content

Describe your IT infrastructure in plain text and convert it to a nice grah

License

Notifications You must be signed in to change notification settings

ndemou/infra2dot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 

Repository files navigation

infra2dot

Describe your IT infrastructure in plain text and convert it to a nice grah

image

Quick Start

There are two steps. Create or edit a plain text file and run 2 commands to get the image. Specifically:

  1. Create a plain text file where you describe your IT infrastructure and save it as something.infra. The above graph was created by this .infra file:
WebServices
    WebService_1  WebService_2
Databases
    Foo__MS_SQL
Clusters // Logical groups of IT Services
    GROUP
        SSO_SRV
        AADConnect
        WAF_AAG
    Microsoft
        M365
        Power_BI
        AzureAD
    Mimecast
        Mimecast
        Mimicast__SMTP
    ISP_1
Hosts // Which services are hosted by which device
    HQ_Router
        Open_Vpn__VPN
    Azure__Web1
        WebService_1
        WebService_2
    Azure__Server_3
        FooService
        Foo__MS_SQL
    HQ__DC
        Windows_AD__1
    HQ__Server_4
        File__Sharing
        Printer__Sharing
    Azure__Server_1 
        Lala_service
        Bar_service
    Azure__DC
        Windows_AD__2

Connections 
    Windows_AD__2 -- Windows_AD__1
    Windows_AD__1 --OpenVpn1-- SSO_SRV
    Windows_AD__1 --OpenVpn1-- AADConnect
    ISP_1 -- Open_Vpn__VPN
    /AAD/ -- AzureAD
    AADConnect -- /AAD/
    AzureAD -- M365
    AzureAD -- Power_BI
    Power_BI -- /SMTP/
    M365 -- /M365/
    WebService_2 -- WAF_AAG
    Bar_service -- Foo__MS_SQL
    Foo__MS_SQL -- FooService
    Foo__MS_SQL -- WebService_1
    FooService -- /SMTP/
    Lala_service -- /SMTP/
    WebService_1 -- /SMTP/
    WebService_1 -- WAF_AAG
    WAF_AAG-- /Internet/
    /SMTP/ -- Mimicast__SMTP
    /AAD/ -- Mimecast
    Mimecast -- /M365/
  1. Run infra2dot.py like this to generate a .dot file and then an svg (or png etc):

    python infra2dot.py -f test.infra -t test-infra.dot
    dot -Tsvg test-infra.dot -o test-infra.svg
    

If you don't want to bother installing graphiz, copy/paste the output to some graphiz online editor like this one

Format of the input file (.infra)

a -- b means that a is connected to b (e.g. application_service -- MS_SQL_server)

a --foo-- b means that a is connected to b via VPN foo

If you have a lot of complex connections you may get a mesh of lines that is hard to follow. To connect two services a and b without a line from one to the other you can use this trick (inspired by the GND and VCC lines of electrical circuits):

a -- /FOO/
b -- /FOO/

FAQ

There are great free tools to draw such diagrams. What are the pros and cons of this method?

Pros

You can create nice looking graphs very quickly. Especially if you need to create a lot of them.

It's very easy to make small and/or incremental changes: Adding a new host and moving a service from another host to it, takes a few seconds. Same for deleting a host or moving a host from one group to another. In a GUI it may very well take half an hour if the objects you touch have central role in the diagram and you need to move a lot of stuff around them.

You do not waste your time twaking little details that don't matter.

You can generate .infra texts and hence nice diagrams programmatically.

Cons

You can not create your first graph without investing a few minutes to understand the syntax.

You can not tweak little details that may matter (like move a line or item just a little bit).

Can I customize the colors or other details

There's no provision for this but it's very easy to change the colors by changing the source code. There's absolutely no need to know python, just search for color and change the RGB colors. If you see colors with 4 instead of 3 values the 4th value is the transparency.

You can change other details the same way, but you need to know your way around graphviz and its .dot language.

About

Describe your IT infrastructure in plain text and convert it to a nice grah

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages