Change example syntax on template module

This commit is contained in:
Sam Doran 2016-10-12 17:43:54 -04:00 committed by Matt Clay
parent a1b945a23e
commit f71134cb98

View file

@ -25,12 +25,12 @@ description:
(U(http://jinja.pocoo.org/docs/)) - documentation on the template (U(http://jinja.pocoo.org/docs/)) - documentation on the template
formatting can be found in the Template Designer Documentation formatting can be found in the Template Designer Documentation
(U(http://jinja.pocoo.org/docs/templates/)). (U(http://jinja.pocoo.org/docs/templates/)).
- "Six additional variables can be used in templates: C(ansible_managed) - "Six additional variables can be used in templates: C(ansible_managed)
(configurable via the C(defaults) section of C(ansible.cfg)) contains a string (configurable via the C(defaults) section of C(ansible.cfg)) contains a string
which can be used to describe the template name, host, modification time of the which can be used to describe the template name, host, modification time of the
template file and the owner uid, C(template_host) contains the node name of template file and the owner uid, C(template_host) contains the node name of
the template's machine, C(template_uid) the owner, C(template_path) the the template's machine, C(template_uid) the owner, C(template_path) the
absolute path of the template, C(template_fullpath) is the absolute path of the absolute path of the template, C(template_fullpath) is the absolute path of the
template, and C(template_run_date) is the date that the template was rendered. Note that including template, and C(template_run_date) is the date that the template was rendered. Note that including
a string that uses a date in the template will result in the template being marked 'changed' a string that uses a date in the template will result in the template being marked 'changed'
each time." each time."
@ -79,11 +79,24 @@ extends_documentation_fragment: validate
EXAMPLES = ''' EXAMPLES = '''
# Example from Ansible Playbooks # Example from Ansible Playbooks
- template: src=/mytemplates/foo.j2 dest=/etc/file.conf owner=bin group=wheel mode=0644 - template:
src: /mytemplates/foo.j2
dest: /etc/file.conf
owner: bin
group: wheel
mode: 0644
# The same example, but using symbolic modes equivalent to 0644 # The same example, but using symbolic modes equivalent to 0644
- template: src=/mytemplates/foo.j2 dest=/etc/file.conf owner=bin group=wheel mode="u=rw,g=r,o=r" - template:
src: /mytemplates/foo.j2
dest: /etc/file.conf
owner: bin
group: wheel
mode: "u=rw,g=r,o=r"
# Copy a new "sudoers" file into place, after passing validation with visudo # Copy a new "sudoers" file into place, after passing validation with visudo
- template: src=/mine/sudoers dest=/etc/sudoers validate='visudo -cf %s' - template:
src: /mine/sudoers
dest: /etc/sudoers
validate: 'visudo -cf %s'
''' '''