Ansible Module template

From NovaOrdis Knowledge Base
Jump to navigation Jump to search

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".