Skip to content

Custom Templates for eos_cli_config_gen

With Custom Templates for the eos_cli_config_gen role, the user can create additional CLI configurations for features not covered by the built-in templates.

Create a Custom Template

Custom templates should be written in Jinja2.

For details on how to create Jinja2 templates, see Templating Jinja2.

Custom templates can utilize variables defined by all the AVD variable definition mechanisms. For more details, see the explanation in Custom Structured Configuration.

Suppose the required variable is not available by any of these mechanisms. In that case, it can be defined using a custom template in the eos_designs role. For more details see Custom Templates for eos_designs.

At runtime, eos_cli_config_gen searches for custom templates in the following location, therefore, custom templates should be saved here:

<path to users AVD implementation>/playbooks/templates/<template name>

The “templates” folder does not exist by default, so it must be created.

Adding the Custom Template to group vars

For the custom template to be automatically discovered and rendered by eos_cli_config_gen, a variable that references the template should be added to the inventory group vars.

The format of the variable should be as follows:

  - custom_template_name.j2

For more details, see Extensibility with Custom Templates

Adding the Custom Template to the eos_cli_config_gen Role

Custom templates are rendered automatically when the custom_templates variable is set. The custom templates are always rendered after the builtin eos_cli_config_gen templates.