Search code examples
ansibleansible-inventory

ansible: how to copy files from a linked directory


I have a symbolically linked folder in linux and would like to copy the contents of the folder to a folder on a remote machine. I tried so far using the synchronize command because I am trying to copy the entire tree, folders and files.
When I run the synchronize command, it is creating the folder as a symbolic link and the folder is empty. How can I copy the contents of the symbolic link without creating a symbolic link?


Solution

  • you can use

      copy_links: yes
    

    with synchronize module.

    "Copy symlinks as the item that they point to (the referent) is copied, rather than the symlink."

    synchronize module Ref