Call Templar or Template from a Custom Plugin

I’m writing a custom plugin and everything works great, except I’d like to use the built in Template task. However, if I’m unable to reference the template library correctly.

I’ve tried:

from ansible.plugins.action import ActionBase
from ansible.utils import Template
from ansible.template import Templar

I’ve tried:

template_return = self.runner._execute_module(conn, tmp, ‘template’, template_args, inject=inject, complex_args=complex_args, persist_files=True)

with no success.

Any input would be greatly appreciated.

You want to call out to the template action plugin, not the module.

I think synchronize has an example?