diff --git a/library/files/file b/library/files/file index 88c3c4d324..b716610633 100644 --- a/library/files/file +++ b/library/files/file @@ -280,13 +280,14 @@ def main(): elif state in ['link','hard']: - if os.path.isabs(src): - abs_src = src - else: - module.fail_json(msg="absolute paths are required") + if state == 'hard': + if os.path.isabs(src): + abs_src = src + else: + module.fail_json(msg="absolute paths are required") - if not os.path.exists(abs_src) and not force: - module.fail_json(path=path, src=src, msg='src file does not exist') + if not os.path.exists(abs_src) and not force: + module.fail_json(path=path, src=src, msg='src file does not exist') if prev_state == 'absent': changed = True