.\" Automatically generated by Pandoc 2.2.1 .\" .TH "IONIT" "1" "2018\-08\-13" "ionit" "ionit's Manual" .hy .SH NAME .PP ionit \- Render configuration files from Jinja templates .SH SYNOPSIS .PP \f[B]ionit\f[] [\f[B]OPTIONS\f[]] .SH DESCRIPTION .PP \f[B]ionit\f[] is a simple and small configuration templating tool. It collects a context and renders Jinja templates in a given directory. The context can be either static JSON or YAML files or dynamic Python files. Python files can also define functions passed through to the rendering. .PP The context filenames needs to end with \f[I].json\f[] for JSON, \f[I].py\f[] for Python, and \f[I].yaml\f[] for YAML. The context files are read in alphabetical order. If the same key is defined by multiple context files, the file that is read later takes precedence. It is recommended to prefix the files with a number in case the order is relevant. .PP \f[B]ionit\f[] comes with an early boot one shot service that is executed before the networking service which allows one to generate configurations files for the networking and other services before they are started. In this regard, ionit can act as tiny stepbrother of cloud\-init. .SH OPTIONS .TP .B \f[B]\-c\f[] \f[I]/path/to/config\f[], \f[B]\[en]config\f[] \f[I]/path/to/config\f[] Configuration directory containing context for rendering (default: \f[I]/etc/ionit\f[]) .RS .RE .TP .B \f[B]\-t\f[] \f[I]/path/to/templates\f[], \f[B]\[en]templates\f[] \f[I]/path/to/templates\f[] Directory to search for Jinja templates (default: \f[I]/etc\f[]) .RS .RE .TP .B \f[B]\-e\f[] \f[I]TEMPLATE_EXTENSION\f[], \f[B]\[en]template\-extension\f[] \f[I]TEMPLATE_EXTENSION\f[] Extension to look for in template directory (default: \f[I]jinja\f[]) .RS .RE .TP .B \f[B]\[en]debug\f[] Print debug output .RS .RE .TP .B \f[B]\-q\f[], \f[B]\[en]quiet\f[] Decrease output verbosity to warnings and errors. .RS .RE .SH PYTHON MODULES .PP Python modules can define a \f[I]collect_context\f[] function. This function is called by ionit and the current context is passed as parameter. The current context can be used to derive more context information, but this variable should not be modified. \f[I]collect_context\f[] must return a dictionary (can be empty) or raise an exception, which will be caught by ionit. .PP Python modules can also define functions which can be called from the Jinja template on rendering. Use the \f[I]ionit_plugin.function\f[] decorator to mark the functions to export. .PP Note that the functions names should not collide with other keys from the context. If one Python module defines a function and a value in the context with the same name, the value in the context will take precedence. .PP An example Python module might look like: .IP .nf \f[C] import\ ionit_plugin \@ionit_plugin.function def\ double(value): \ \ \ \ return\ 2\ *\ value \@ionit_plugin.function def\ example_function(): \ \ \ \ return\ "Lorem\ ipsum" def\ collect_context(current_context): \ \ \ \ return\ {"key":\ "value"} \f[] .fi .SH AUTHOR .PP Benjamin Drung