On Tuesday, 27 February 2018 18.30.09 CET ZillaYT wrote:
> Ansible v2.4.0.0
> 
> I want to copy the contents of a local directory to my target host, but the 
> recursive option copies the directory itself. That is
> 
> - name: Copy local files target
>    copy:
>      src: /tmp/local_dir
>      dest: /some_path/remote_dir
>      recurse: yes
> 
> /tmp/local_dir has
> - dir1/some_dirs_and_files
> - dir2/some_dirs_and_files
> 
> 
> The result has this on the target host
> 
> /some_path/remote_dir/local_dir/dir1
> /some_path/remote_dir/local_dir/dir2
> 
> ...but I want this
> /some_path/remote_dir/dir1
> /some_path/remote_dir/dir2
> 
> Is this achievable?

The docs have the answer

"src:  -  If path is a directory, it is copied recursively. In this case, if 
path ends with "/", only inside contents of that directory are copied to 
destination. Otherwise, if it does not end with "/", the directory itself with 
all contents is copied."


-- 
Kai Stian Olstad

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/5302344.j4r4CS2ipy%40x1.
For more options, visit https://groups.google.com/d/optout.

Reply via email to