diff --git a/lib/ansible/module_utils/basic.py b/lib/ansible/module_utils/basic.py index 88df2d77d3c..6ff8a389760 100644 --- a/lib/ansible/module_utils/basic.py +++ b/lib/ansible/module_utils/basic.py @@ -1114,7 +1114,7 @@ class AnsibleModule(object): if underlying_stat.st_mode != new_underlying_stat.st_mode: os.chmod(b_path, stat.S_IMODE(underlying_stat.st_mode)) except OSError as e: - if os.path.islink(b_path) and e.errno == errno.EPERM: # Can't set mode on symbolic links + if os.path.islink(b_path) and e.errno in (errno.EPERM, errno.EROFS): # Can't set mode on symbolic links pass elif e.errno in (errno.ENOENT, errno.ELOOP): # Can't set mode on broken symbolic links pass