Ansible Module template

From NovaOrdis Knowledge Base
Revision as of 18:43, 19 January 2021 by Ovidiu (talk | contribs) (Created page with "=External= * http://docs.ansible.com/ansible/latest/template_module.html =Internal= * Ansible Concepts =Example= <syntaxhighlight lang='yaml...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

External

Internal

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.