\n
lnk_source
=> Target of the symlink normalized for the remote filesystemlnk_target
=> Target of the symlink. Note that relative paths remain relativeFor the actual SOURCE of the symlink, well, it's just path
.
Reputation: 1749
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.
Upvotes: 6
Views: 7915
Reputation: 68329
stat
module returns lnk_source
and lnk_target
which should do the trick.
lnk_source
=> Target of the symlink normalized for the remote filesystemlnk_target
=> Target of the symlink. Note that relative paths remain relativeFor the actual SOURCE of the symlink, well, it's just path
.
Upvotes: 11