.. _ansible.windows.win_template_module:
****************************
ansible.windows.win_template
****************************
**Template a file out to a remote server**
.. contents::
:local:
:depth: 1
Synopsis
--------
- Templates are processed by the `Jinja2 templating language `_.
- Documentation on the template formatting can be found in the `Template Designer Documentation `_.
- Additional variables listed below can be used in templates.
- ``ansible_managed`` (configurable via the ``defaults`` section of ``ansible.cfg``) contains a string which can be used to describe the template name, host, modification time of the template file and the owner uid.
- ``template_host`` contains the node name of the template's machine.
- ``template_uid`` is the numeric user id of the owner.
- ``template_path`` is the path of the template.
- ``template_fullpath`` is the absolute path of the template.
- ``template_destpath`` is the path of the template on the remote system (added in 2.8).
- ``template_run_date`` is the date that the template was rendered.
Parameters
----------
.. raw:: html
| Parameter |
Choices/Defaults |
Comments |
|
backup
boolean
|
|
Determine whether a backup should be created.
When set to yes, create a backup file including the timestamp information so you can get the original file back if you somehow clobbered it incorrectly.
|
|
block_end_string
string
|
Default:
"%}"
|
The string marking the end of a block.
|
|
block_start_string
string
|
Default:
"{%"
|
The string marking the beginning of a block.
|
|
dest
path
/ required
|
|
Location to render the template to on the remote machine.
|
|
force
boolean
|
|
Determine when the file is being transferred if the destination already exists.
When set to yes, replace the remote file when contents are different than the source.
When set to no, the file will only be transferred if the destination does not exist.
|
|
lstrip_blocks
boolean
|
|
Determine when leading spaces and tabs should be stripped.
When set to yes leading spaces and tabs are stripped from the start of a line to a block.
This functionality requires Jinja 2.7 or newer.
|
|
newline_sequence
string
|
|
Specify the newline sequence to use for templating files.
|
|
output_encoding
string
|
Default:
"utf-8"
|
Overrides the encoding used to write the template file defined by dest.
It defaults to utf-8, but any encoding supported by python can be used.
The source template file must always be encoded using utf-8, for homogeneity.
|
|
src
path
/ required
|
|
Path of a Jinja2 formatted template on the Ansible controller.
This can be a relative or an absolute path.
The file must be encoded with utf-8 but output_encoding can be used to control the encoding of the output template.
|
|
trim_blocks
boolean
|
|
Determine when newlines should be removed from blocks.
When set to yes the first newline after a block is removed (block, not variable tag!).
|
|
variable_end_string
string
|
Default:
"}}"
|
The string marking the end of a print statement.
|
|
variable_start_string
string
|
Default:
"{{"
|
The string marking the beginning of a print statement.
|