tasks

nornir_jinja2.plugins.tasks.template_file(task: nornir.core.task.Task, template: str, path: str, jinja_filters: Optional[Dict[str, Callable[[…], str]]] = None, jinja_env: Optional[jinja2.environment.Environment] = None, **kwargs: Any) → 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

  • jinja_env – A fully configured jinja2 environment

  • **kwargs – additional data to pass to the template

Returns

  • result (string): rendered string

Return type

Result object with the following attributes set

nornir_jinja2.plugins.tasks.template_string(task: nornir.core.task.Task, template: str, jinja_filters: Optional[Dict[str, Callable[[…], str]]] = None, jinja_env: Optional[jinja2.environment.Environment] = None, **kwargs: Any) → 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