Ansible Module copy: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
No edit summary
Line 15: Line 15:
     dest: "{{ ansible_env.SOME_DIR }}/.envrc"
     dest: "{{ ansible_env.SOME_DIR }}/.envrc"
     mode: "u=rw,g=r,o=r"
     mode: "u=rw,g=r,o=r"
</syntaxhighlight>
<syntaxhighlight lang='yaml'>
- name: Copy bashrc scripts
  template:
    src: "{{ item }}"
    dest: "{{rc_d}}"
    mode: "u=rwx,g=rx,o=rx"
  with_fileglob:
    - "*.sh"
</syntaxhighlight>
</syntaxhighlight>


The files can be placed in:
The files can be placed in:


* <role>/templates
* <role>/files

Revision as of 18:39, 19 January 2021

External

Internal

Example

- name: Copy .envrc script
  template:
    src: envrc
    dest: "{{ ansible_env.SOME_DIR }}/.envrc"
    mode: "u=rw,g=r,o=r"

The files can be placed in:

  • <role>/files