1
# this is a virtual module that is entirely implemented server side
6
short_description: Templates a file out to a remote server.
8
- Templates are processed by the Jinja2 templating language
9
(U(http://jinja.pocoo.org/docs/)) - documentation on the template
10
formatting can be found in the Template Designer Documentation
11
(U(http://jinja.pocoo.org/docs/templates/)).
12
- "Six additional variables can be used in templates: C(ansible_managed)
13
(configurable via the C(defaults) section of C(ansible.cfg)) contains a string
14
which can be used to describe the template name, host, modification time of the
15
template file and the owner uid, C(template_host) contains the node name of
16
the template's machine, C(template_uid) the owner, C(template_path) the
17
relative path of the template, C(template_fullpath) is the absolute path of the
18
template, and C(template_run_date) is the date that the template was rendered."
22
- Path of a Jinja2 formatted template on the local server. This can be a relative or absolute path.
28
- Location to render the template to on the remote machine.
33
- Create a backup file including the timestamp information so you can get
34
the original file back if you somehow clobbered it incorrectly.
36
choices: [ "yes", "no" ]
40
- validation to run before copying into place
46
- all arguments accepted by the M(file) module also work here
49
- Since Ansible version 0.9, templates are loaded with C(trim_blocks=True).
50
- 'You can override jinja2 settings by adding a special header to template file.
51
i.e. C(#jinja2: trim_blocks: False)'
53
author: Michael DeHaan
57
# Example from Ansible Playbooks
58
- template: src=/mytemplates/foo.j2 dest=/etc/file.conf owner=bin group=wheel mode=0644
60
# Copy a new "sudoers file into place, after passing validation with visudo
61
- action: template src=/mine/sudoers dest=/etc/sudoers validate='visudo -cf %s'