Ansible Module template: Difference between revisions
Jump to navigation
Jump to search
Line 23: | Line 23: | ||
Note that <role>/templates subdirectories will be automatically scanned so only the file name can be specified. | Note that <role>/templates subdirectories will be automatically scanned so only the file name can be specified. | ||
=Parameters= | =Parameters= | ||
==<tt>force</tt>== | |||
Determine whether the file is transferred if the destination already exists. Options: "yes": replace the remote file when contents are different than the source. "no": The file will only be transferred if the destination does not exist. Default "yes". |
Latest revision as of 20:12, 8 July 2021
External
Internal
Overview
Example
- name: Copy .envrc script
template:
src: envrc.j2
dest: "{{ ansible_env.SOME_DIR }}/.envrc"
mode: "u=rw,g=r,o=r"
The files can be placed in:
- <role>/templates
Note that <role>/templates subdirectories will be automatically scanned so only the file name can be specified.
Parameters
force
Determine whether the file is transferred if the destination already exists. Options: "yes": replace the remote file when contents are different than the source. "no": The file will only be transferred if the destination does not exist. Default "yes".