Minimal

In the minimal example vars is not defined and all keys in the fmf file are used as Jinja variables. By default, the fmf root (/) is used as a template folder unless templates key is specified.

The example in example/minimal contains a minimal template format for fmf-jinja. Inside we have a fmf tree defined by:

/main.fmf
# By default, all keys are treated as variables for jinja unless a `vars` variable is defined
# or the key starts with a `/`.
var1: 42
var2: Default value

# The path-like keys are the output (root) paths generated
/rootA:
/rootB:
  var2: Overwritten

The template folder contains a file common_file.txt that is simply copied over and a template file file.yaml.j2 which generates a file.yaml.

/file.yaml.j2
var0: random data
var1: {{ var1 }}
var2: {{ var2 }}

Running fmf-jinja on this example we get:

$ fmf-jinja -r example/minimal generate -o output
$ tree -a output
output/
├── .fmf
│   └── version
├── main.fmf
├── rootA
│   ├── common_file.txt
│   └── file.yaml
└── rootB
    ├── common_file.txt
    └── file.yaml
$ tail output/root*/file.yaml
==> output/rootA/file.yaml <==
var0: random data
var1: 42
var2: Default value

==> output/rootB/file.yaml <==
var0: random data
var1: 42
var2: Overwritten