From dc4d589ce0bc653bbc075ee1d13a45a8fb427639 Mon Sep 17 00:00:00 2001 From: James Tanner Date: Fri, 1 Nov 2013 09:41:22 -0400 Subject: [PATCH] Fixes #4767 detect hard links and set state in add_file_info --- lib/ansible/module_utils/basic.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/ansible/module_utils/basic.py b/lib/ansible/module_utils/basic.py index 7b41c03c16e..a04d6c403ee 100644 --- a/lib/ansible/module_utils/basic.py +++ b/lib/ansible/module_utils/basic.py @@ -511,6 +511,8 @@ class AnsibleModule(object): kwargs['state'] = 'link' elif os.path.isdir(path): kwargs['state'] = 'directory' + elif os.stat(path).st_nlink > 1: + kwargs['state'] = 'hard' else: kwargs['state'] = 'file' if HAVE_SELINUX and self.selinux_enabled():