Ansible Module template: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
(Created page with "=External= * http://docs.ansible.com/ansible/latest/template_module.html =Internal= * Ansible Concepts =Example= <syntaxhighlight lang='yaml...")
 
Line 4: Line 4:


=Internal=
=Internal=
* [[Ansible_Concepts#template|Ansible Concepts]]
* [[Ansible_Concepts#template|Ansible Concepts]]
=Overview=


=Example=
=Example=

Revision as of 20:09, 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.