diff --git a/lib/ansible/module_utils/basic.py b/lib/ansible/module_utils/basic.py index 8124eb9a705..18f1e5c0db7 100644 --- a/lib/ansible/module_utils/basic.py +++ b/lib/ansible/module_utils/basic.py @@ -1132,9 +1132,9 @@ class AnsibleModule(object): return True try: os.lchown(b_path, uid, -1) - except OSError: + except (IOError, OSError) as e: path = to_text(b_path) - self.fail_json(path=path, msg='chown failed') + self.fail_json(path=path, msg='chown failed: %s' % (to_text(e))) changed = True return changed