diff --git a/lib/ansible/modules/system/cron.py b/lib/ansible/modules/system/cron.py index 8e1a9a25ddb..90d5c4d6aac 100644 --- a/lib/ansible/modules/system/cron.py +++ b/lib/ansible/modules/system/cron.py @@ -69,6 +69,7 @@ options: job: description: - The command to execute or, if env is set, the value of environment variable. + The command should not contain line breaks. Required if state=present. required: false aliases: ['value'] @@ -718,6 +719,11 @@ def main(): changed = True else: if do_install: + for char in ['\r', '\n']: + if char in job.strip('\r\n'): + warnings.append('Job should not contain line breaks') + break + job = crontab.get_cron_job(minute, hour, day, month, weekday, job, special_time, disabled) old_job = crontab.find_job(name, job)