diff options
-rw-r--r-- | changelogs/fragments/cron_err.yml | 3 | ||||
-rw-r--r-- | lib/ansible/modules/cron.py | 2 |
2 files changed, 4 insertions, 1 deletions
diff --git a/changelogs/fragments/cron_err.yml b/changelogs/fragments/cron_err.yml new file mode 100644 index 0000000000..5e65a7b68e --- /dev/null +++ b/changelogs/fragments/cron_err.yml @@ -0,0 +1,3 @@ +--- +minor_changes: + - cron - Provide additional error information while writing cron file (https://github.com/ansible/ansible/issues/83223). diff --git a/lib/ansible/modules/cron.py b/lib/ansible/modules/cron.py index 5c2b2a12c2..dcd350159c 100644 --- a/lib/ansible/modules/cron.py +++ b/lib/ansible/modules/cron.py @@ -328,7 +328,7 @@ class CronTab(object): os.unlink(path) if rc != 0: - self.module.fail_json(msg=err) + self.module.fail_json(msg=f"Failed to install new cronfile: {path}", stderr=err, stdout=out, rc=rc) # set SELinux permissions if self.module.selinux_enabled() and self.cron_file: |