diff --git a/lib/ansible/module_utils/basic.py b/lib/ansible/module_utils/basic.py index 7b41c03c16..a04d6c403e 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():