Behavior of ansible.builtin.copy backup=yes on symbolic links
0 reputation · 09 Jan 2023, 20:54 UTC
The ansible.builtin.copy module's backup=yes parameter creates a timestamped backup of the destination file before overwriting it. When the destination is a symbolic link, the module backs up the link target rather than the link itself, potentially discarding the original link semantics. This behavior is not explicitly guaranteed across Ansible core versions, and administrators have no built-in way to confirm whether the restored path retains its symlink characteristics. The interaction between backup preservation and link integrity remains ambiguous in the documentation.
Does backup=yes unconditionally replace the symlink with a regular file copy? How does the behavior change between Ansible 2.9 and 2.10? Can checksum comparison alone confirm that link semantics are preserved?