Text

nornir.plugins.tasks.text.template_file(task: nornir.core.task.Task, template: str, path: str, jinja_filters: Optional[Dict[str, Callable[..., str]]] = None, **kwargs) → nornir.core.task.Result

Renders contants of a file with jinja2. All the host data is available in the template

Parameters:
  • template – filename
  • path – path to dir with templates
  • jinja_filters – jinja filters to enable. Defaults to nornir.config.jinja2.filters
  • **kwargs – additional data to pass to the template
Returns:

  • result (string): rendered string

Return type:

Result object with the following attributes set

nornir.plugins.tasks.text.template_string(task: nornir.core.task.Task, template: str, jinja_filters: Optional[Dict[str, Callable[..., str]]] = None, **kwargs) → nornir.core.task.Result

Renders a string with jinja2. All the host data is available in the template

Parameters:
  • template (string) – template string
  • jinja_filters (dict) – jinja filters to enable. Defaults to nornir.config.jinja2.filters
  • **kwargs – additional data to pass to the template
Returns:

  • result (string): rendered string

Return type:

Result object with the following attributes set