How do I get the full path of a symlink target in Ansible? I'm trying to cleanup a folder--delete files older than x number of days but I don't want to remove the target of a particular file symlink. My plan is to get the symlink target and then use the value as an exclude target when using the find
module.
The symlink target changes from time to time. I tried using the stat
module but it doesn't solve my requirement.
stat
module returns lnk_source
and lnk_target
which should do the trick.
lnk_source
=> Target of the symlink normalized for the remote filesystem
lnk_target
=> Target of the symlink. Note that relative paths remain relative
For the actual SOURCE of the symlink, well, it's just path
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With