diff --git a/CHANGELOG.md b/CHANGELOG.md index fa56cf30ec1..ab1ce8f4ef2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -104,6 +104,7 @@ Ansible Changes By Release https://github.com/ansible/ansible/issues/24169 * Do not log data field in `docker_secrets` module (https://github.com/ansible/ansible/pull/31366) * Fix rpm_key taking the wrong 8 chars from the keyid (https://github.com/ansible/ansible/pull/31045) +* chown errors now more informative diff --git a/lib/ansible/module_utils/basic.py b/lib/ansible/module_utils/basic.py index 264152d0b34..8006415df4e 100644 --- a/lib/ansible/module_utils/basic.py +++ b/lib/ansible/module_utils/basic.py @@ -1133,9 +1133,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