diff --git a/files/replace.py b/files/replace.py index b7b75a9604d..588af02391e 100644 --- a/files/replace.py +++ b/files/replace.py @@ -152,6 +152,8 @@ def main(): if changed and not module.check_mode: if params['backup'] and os.path.exists(dest): module.backup_local(dest) + if params['follow'] and os.path.islink(dest): + dest = os.path.realpath(dest) write_changes(module, result[0], dest) msg, changed = check_file_attrs(module, changed, msg)