• Stars
    star
    195
  • Rank 199,374 (Top 4 %)
  • Language
    CSS
  • License
    MIT License
  • Created about 7 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Template designer for automation

screenshot

Template Designer for Automation

Try it now

https://td4a.codethenetwork.com

Overview

TD4A is a visual design aid for building and testing jinja2 templates. It will combine data in yaml format with a jinja2 template and render the output.

All jinja2 filters are supported along with the filter plugins from Ansible version 2.9.12

Installation:

using podman (or docker):
podman pull cidrblock/td4a

The container registry page can be found here:

https://hub.docker.com/r/cidrblock/td4a/

using the cli:

$ virtualenv venv
$ source venv/bin/activate
$ pip install td4a

The pip package can be found here:

https://pypi.python.org/pypi/td4a

Starting the TD4A server

Simple

using podman (or docker):
podman run -p 5000:5000 cidrblock/td4a
using the cli:
td4a-server
open your browser to:

http://127.0.0.1:5000

Modes

TD4A support two different modes of operation.

  • Templating: Build and render jinja2 templates
  • Schema: Build and validate a json schema for your data

Enabling a mode

using podman (or docker):
podman run  -p 5000:5000 \
            -it \
            cidrblock/td4a \
            td4a-server -m mode
using the cli:
td4a-server -m mode

where mode is either jinja2 (default) or schema

Additional configuration options

Loading custom filter plugins (jinja2 mode only)

TD4A supports custom filter plugins within the container. Pass your custom filter_plugins directory as a volume and use the -f option to specify to custom filter plugin directory.

using podman (or docker):
podman run  -p 5000:5000 \
            -it \
            -v `pwd`/my_filter_plugins:/filter_plugins \
            cidrblock/td4a \
            td4a-server -f /filter_plugins
using the cli:

TD4A can load custom filters from a directory specified from the command line:

td4a-server -f ./my_filter_plugins

Loading an ansible inventory (jinja2 and schema mode)

Mount the inventory as /inventory in the container, and run TD4A with the -i option.

using podman (or docker):
podman run  -p 5000:5000 \
            -it \
            -v '/Users/me/github/ansible_network_inventory:/inventory' \
            cidrblock/td4a \
            td4a-server -i /inventory -m mode -v 'my_vault_password'

If environment variables are needed for a dynamic inventory, they can be passed to the docker container.

podman run  -p 5000:5000 \
            -it \
            -v `pwd`/my_filter_plugins:/filter_plugins \
            -v '/Users/me/github/ansible_network_inventory:/inventory' \
            -e "COUCH_USERNAME=admin" \
            -e "COUCH_PASSWORD=password" \
            -e "COUCH_URL=http://192.168.1.5:5984/td4a" \
            -e "DYNAMIC_INVENTORY_USERNAME=api" \
            -e "DYNAMIC_INVENTORY_PASSWORD=password" \
            cidrblock/td4a \
            td4a-server -f /filter_plugins -m mode -i /inventory -v 'my_vault_password'
using the cli:

TD4A can load multiple ansible inventories, specifc each with -i on the command line:

td4a-server -i ./my_ansible_inventory -v 'my_vault_password'

Enabling storage and links using a couch database (jinja2 and schema mode)

TD4A has the ability to store data and templates in a CouchDB. This is disabled by default.

The CouchDB needs to previously created.

To enable link support, and add the link button to the UI, set the following environ variables:

using podman (or docker):
podman run  -p 5000:5000 \
            -v `pwd`/my_filter_plugins:/filter_plugins \
            -e "COUCH_USERNAME=admin" \
            -e "COUCH_PASSWORD=password" \
            -e "COUCH_URL=http://192.168.1.5:5984/td4a" \
            cidrblock/td4a \
            td4a-server -m mode
using the cli:
export COUCH_USERNAME=admin
export COUCH_PASSWORD=password
export COUCH_URL=http://localhost:5984/td4a
td4a-server -m mode

User Interface

The interface is browser based and has been tested using Chrome. If your browser did not automatically open when TD4A was started, you can visit http://127.0.0.1:5000 to see the interface.

The UI is broken into three sections:

  1. DATA, this is where the data in yaml format is provided.
  2. TEMPLATE, the jinja2 template to be rendered.
  3. RESULT, after clicking the render button, the result pane will be populated with the rendered template.

Keyboard shortcuts

cmd+r: Render the template

cmd+s: Save the data in browser local storage

cmd+b: Begin new, clear the screen

Python version

To date, this has only been tested with python 3.8.5.

Development

NPM and related packages are required to build the UI.

npm install

The UI components can be installed for development purposes using bower.

bower install

The dependancies can be concatenated and minified using gulp.

gulp

More Repositories

1

drawthe.net

drawthe.net draws network diagrams dynamically from a text file describing the placement, layout and icons. Given a yaml file describing the hierarchy of the network and it's connections, a resulting diagram will be created.
JavaScript
1,025
star
2

netcopa

Network Configuration Parser
Python
134
star
3

subnetter

Visualize and design networks
CSS
71
star
4

home_journal

A self-hosted mini journaling site for families for capturing memories, stories, photos, ideas, jokes and anything else you want to remember
CSS
36
star
5

Network-automation-and-devops-resources

11
star
6

f5_health_check

Automated health check, configuration and state collection using ansible for bigip
Python
10
star
7

add_dhcp_helper_address

Adds a dhcp address to any interface that has one
Python
7
star
8

virtual_appliances

Build virtual nxos and eos appliance on Centos with KVM
Python
5
star
9

RBFS

REST based file server
JavaScript
4
star
10

ansible_and_netcopa

Python
4
star
11

modelsettings

Modelsettings is a straight-forward, easy to use python application settings manager that includes ini file, environment variable, and command-line parameter support.
Python
4
star
12

shared_ansible_data_model

An ansible playbook demonstrating inheritance and data models
Python
3
star
13

sot_vlans

Using Ansible to move the source of truth for VLANs on NX-OS
Python
3
star
14

tyk-ansible

Python
3
star
15

parse

Python
3
star
16

devpak

Python
3
star
17

docker_swagger_editor

Swagger editor running in a docker container w/ autosave enabled
HTML
3
star
18

f5_yamlr

Dump a bigIP virtual server and it's components to yaml files
Python
2
star
19

wait_for_delayed

2
star
20

docker_ansible

Python
2
star
21

dci_test

HTML
2
star
22

brownfield_inventory_builder

Python
2
star
23

identify_port_profiles_across_devices

Python
2
star
24

fest22

Demo repository for ansible-fest 2022
Dockerfile
2
star
25

acl_name_finder

Python
1
star
26

cli_parse_guide

1
star
27

network_demo_content

1
star
28

node_snmp

JavaScript
1
star
29

infoblox-py

Python
1
star
30

role_ansible_change_report

1
star
31

rm_planning

HTML
1
star
32

example_empty_playbook

An example using ansible galaxy to install roles
Shell
1
star
33

ansible_via_python

Python
1
star
34

codegenit

Python project generator from a swagger file
Python
1
star
35

container_in_container

Dockerfile
1
star