IONIT(1)
π¦ IONIT β the manual, but make it make sense
okay bestie, so this is the ionit man page, and honestly? she's a whole vibe. tiny tool, big main character energy. let's get into it β¨
β¨ NAME β¨
ionit β render configuration files from Jinja templates π
β¨ SYNOPSIS β¨
ionit [OPTIONS]
that's it. that's the whole thing. no positional args, no drama. π
β¨ DESCRIPTION β¨
ionit is a simple and small configuration templating tool. no cap, that's literally the description. she collects a context and renders Jinja templates in a given directory. and the context? it can be either static JSON or YAML files, or dynamic Python files. and the Python files can also define functions that get passed through to the rendering. iconic behavior fr fr π
now here's the rules for the context filenames, bestie, write these down:
- it needs to end with
.jsonfor JSON .pyfor Python.yamlfor YAML
the context files are read in alphabetical order. so if the same key is defined by multiple context files, the file that is read later takes precedence (last one wins, periodt). so yeah β it is recommended to prefix the files with a number in case the order is relevant. like 10-networking.json, 20-users.yaml, you get it. π§
ionit comes with an early boot one shot service that is executed before the networking service, which lets you generate configuration files for the networking and other services before they are even started. so in that regard, ionit can act as a tiny stepbrother of cloud-init. π tiny stepbrother. i'm obsessed.
β¨ OPTIONS β¨
-c /path/to/config,--config /path/to/configβ configuration directory containing context for rendering (default:/etc/ionit) ποΈ-t /path/to/templates,--templates /path/to/templatesβ directory to search for Jinja templates (default:/etc) π-e TEMPLATE_EXTENSION,--template-extension TEMPLATE_EXTENSIONβ extension to look for in the template directory (default:jinja) π--debugβ print debug output π-q,--quietβ decrease output verbosity to warnings and errors. she goes quiet, she's just observing π€«
β¨ PYTHON MODULES β¨
okay this part is lowkey the coolest part, so pay attention bestie π
Python modules can define a collect_context function. this function is called by ionit, and the current context is passed as a parameter. you can use the current context to derive more context information, but this variable should not be modified. do not touch. hands off. π
collect_context must return a dictionary (can be empty) or raise an exception β which will be caught by ionit. so you're safe either way, she's not gonna crash on you. π«Ά
Python modules can also define functions which can be called from the Jinja template on rendering. use the ionit_plugin.function decorator to mark the functions to export. that decorator is the little glow-up that says "yes, this one goes in the template" β¨
β οΈ note that the function 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. context wins. always. sorry to your function, she got outshined π
an example Python module might look like:
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"}
look at her. double, example_function, collect_context β all doing their little jobs, all thriving. "Lorem ipsum" really said placeholder text but make it fashion πΈ
β¨ AUTHOR β¨
Benjamin Drung bdrung@posteo.de π
and that's the whole page, bestie!! π this was ionit's Manual, dated 2018-08-13, and yeah the footer says version ionit too β so go forth, render those templates, and remember: alphabetical order, last key wins, don't modify the context. slay πβπ
π¦ where this page comes from
- debian trixie: ionit 0.5.1-2 Β· ISC
- ubuntu questing: ionit 0.5.1-2
- ubuntu resolute: ionit 0.5.1-2build1 Β· ISC
- ubuntu stonking: ionit 0.5.1-2build1 Β· ISC
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms