As i work with Ansible (or I try to learn Ansible) sometimes i want to test little j2 snippets (Used in templates/when conditions / others within Ansible). You can ipython (or your fav repl ) and do it manually or you can use (and contribute) to this little tool i built yesterday.
Iāve called jinrepl (lack of a better name)Ā , and it basically evals strings into j2.template and renders itĀ , nothing major, but with a few neat features.
Featuring:
https://github.com/bechampion/jinrepl
To install:
pip install termcolorpip install jinja2git clone https://github.com/bechampion/jinreplcd jinreplpython jinrepl.py
Thatās pretty much everything you need so far (with the current set of features)
Features
-
In line jinja rendering
-
Filter autocompletion
- Conditional and statements autocomplete
But my favourite isĀ , embedded Vim! (haha just os.system(āvimā))
It does a fair bit moreĀ , but you can find all about it on the github repo.