I have a destination for file copy as a variable file_path
, how can I copy files to that destination using template/copy modules?
Tried:
---
- hosts: localhost
connection: local
tasks:
- name: variable
command: echo "emptyDir"
register: file_path
- name: check var value
debug:
var: file_path
verbosity: 2
- name: copy mod
template:
src: "{{ item }}"
dest: "{{ file_path }}"
mode: 0755
with_items:
- "file1.txt"
- "file2.txt"
Error: If copy module is used copyModule error
If template module is used templateModule error
But throws some dict - string error.
Any help is appreciated.
TIA