diff --git a/lib/ansible/module_common.py b/lib/ansible/module_common.py index 508fe93de18..8e221ad9e75 100644 --- a/lib/ansible/module_common.py +++ b/lib/ansible/module_common.py @@ -797,11 +797,7 @@ class AnsibleModule(object): if self.selinux_enabled(): context = self.selinux_default_context(dest) self.set_context_if_different(src, context, False) - try: - shutil.copy2(src, dest) - except shutil.Error, e: - self.fail_json(msg='Could not atomic_replace file: %s to %s: %s' % (src, dest, e)) - + os.rename(src, dest) def run_command(self, args, check_rc=False, close_fds=False, executable=None, data=None): '''