synchronize links

Hello,

I have a question concerning the handling of symlinks with the
synchronize module:

What exactly is the difference between the "link" and "copy_link"
options, and how are they intended to be used? The docs say

Hi,

I have a question concerning the handling of symlinks with the
synchronize module:

What exactly is the difference between the "link" and "copy_link"
options, and how are they intended to be used? The docs say

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

links: Copy symlinks as symlinks.
---

This looks rather redundant to me (plus I do not really understand
what the "is copied" part for copy_links should mean).

the formulation is a bit broken. The "is copied" shouldn't be there.

Feel free to create a PR to remove that part. (The line in question is
here:
https://github.com/ansible-collections/ansible.posix/blob/main/plugins/modules/synchronize.py#L99)

The naming of these two options comes from rsync, BTW. It's man page
says:

       --links, -l copy symlinks as symlinks
       --copy-links, -L transform symlink into referent file/dir

Or in longer form:

--links, -l
    When symlinks are encountered, recreate the symlink on the
    destination.

  --copy-links, -L
    When symlinks are encountered, the item that they point to (the
    referent) is copied, rather than the symlink. [...]

Cheers,
Felix

> ---
> copy_links: Copy symlinks as the item that they point to (the
> referent) is copied, rather than the symlink.
>
> links: Copy symlinks as symlinks.
> ---
>
> This looks rather redundant to me (plus I do not really understand
> what the "is copied" part for copy_links should mean).

the formulation is a bit broken. The "is copied" shouldn't be there.
Feel free to create a PR to remove that part. (The line in question is
here:
https://github.com/ansible-collections/ansible.posix/blob/main/plugins/modules/synchronize.py#L99)

Ok, I'll look into that.

--links, -l
    When symlinks are encountered, recreate the symlink on the
    destination.

  --copy-links, -L
    When symlinks are encountered, the item that they point to (the
    referent) is copied, rather than the symlink. [...]

I still don't understand why both exist, they appear to be mutually
exclusive.
Or is --links intended to copy links, and --copy-links to copy files,
i.e., they are designed to achieve the opposite of each other? In that
case, I do not understand why ansible offers to turn off or on both of
them independently. That might also explain why setting "links: no" in
ansible does not change the behaviour as expected (because the
underlying rsync option is just removed, but that does not force any
other behaviour).

cu
  Gerrit