summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Farzan <jpfarzan@gmail.com>2024-10-01 23:45:27 +0200
committerGitHub <noreply@github.com>2024-10-01 23:45:27 +0200
commit4c8fb12fc2f0d6b7e18986cd43055abec78bf749 (patch)
tree011b02b0b68976da16e4ad6573306e8e8587f1a8
parentdebconf: set empty password value (#83217) (diff)
downloadansible-4c8fb12fc2f0d6b7e18986cd43055abec78bf749.tar.xz
ansible-4c8fb12fc2f0d6b7e18986cd43055abec78bf749.zip
cron: return stdout and rc for cron command (#83290)
Co-authored-by: Jack Farzan <jfarzan@adobe.com>
-rw-r--r--changelogs/fragments/cron_err.yml3
-rw-r--r--lib/ansible/modules/cron.py2
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: