Note
This module is part of ansible-base
and included in all Ansible installations. In most cases, you can use the short module name template even without specifying the collections:
keyword. Despite that, we recommend you use the FQCN for easy linking to the module documentation and to avoid conflicting with other collections that may have the same module name.
New in version 0.9: of ansible.builtin
Parameter | Choices/Defaults | Configuration | Comments |
---|---|---|---|
_terms string | list of files to template | ||
convert_data boolean |
| Whether to convert YAML into data. If False, strings that are YAML will be left untouched. Mutually exclusive with the jinja2_native option. | |
jinja2_native boolean added in 2.11 of ansible.builtin |
| Controls whether to use Jinja2 native types. It is off by default even if global jinja2_native is True. Has no effect if global jinja2_native is False. This offers more flexibility than the template module which does not use Jinja2 native types at all. Mutually exclusive with the convert_data option. | |
variable_end_string string added in 2.8 of ansible.builtin | Default: "}}" | The string marking the end of a print statement. | |
variable_start_string string added in 2.8 of ansible.builtin | Default: "{{" | The string marking the beginning of a print statement. |
- name: show templating results debug: msg: "{{ lookup('template', './some_template.j2') }}" - name: show templating results with different variable start and end string debug: msg: "{{ lookup('template', './some_template.j2', variable_start_string='[%', variable_end_string='%]') }}"
Common return values are documented here, the following are the fields unique to this lookup:
Key | Returned | Description |
---|---|---|
_raw list / elements=any | success | file(s) content after templating |
© 2012–2018 Michael DeHaan
© 2018–2021 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.11/collections/ansible/builtin/template_lookup.html