# cron job variable gets split up

**URL:** <https://forum.ansible.com/t/cron-job-variable-gets-split-up/14291>\
**Category:** Ansible Project\
**Created:** [January 7, 2014, 8:56pm UTC](https://forum.ansible.com/t/cron-job-variable-gets-split-up/14291 "2014-01-07T20:56:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![David\_Reagan](https://avatars.discourse-cdn.com/v4/letter/d/71e660/32.png) [@David\_Reagan](https://forum.ansible.com/u/David_Reagan)\
**Post date:** [January 7, 2014, 8:56pm UTC](https://forum.ansible.com/t/cron-job-variable-gets-split-up/14291/1 "2014-01-07T20:56:20Z")

</div>

I’m trying to make a task that takes a dict of cronjobs, passes the dict through dictsort so that it is a list, the goes through that list via “with\_items” to add each cronjob. For some reason, the job= variable gets screwed up. It comes through as a full string in the debug message, but gets split up in the cron module call.

You can see the vars, tasks, and output here: [http://pastebin.com/2EqaeNb9](http://pastebin.com/2EqaeNb9) Any thoughts?

Sorry for the bad subject and description, I couldn’t think of anything better…

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [January 7, 2014, 10:16pm UTC](https://forum.ansible.com/t/cron-job-variable-gets-split-up/14291/2 "2014-01-07T22:16:05Z")

</div>

Looks like you should quote the job parameter

job={{ foo }}

becomes

job=“{{ foo }}”

---

<div class="post-metadata">

**Author:** ![David\_Reagan](https://avatars.discourse-cdn.com/v4/letter/d/71e660/32.png) [@David\_Reagan](https://forum.ansible.com/u/David_Reagan)\
**Post date:** [January 7, 2014, 10:35pm UTC](https://forum.ansible.com/t/cron-job-variable-gets-split-up/14291/3 "2014-01-07T22:35:18Z")

</div>

Thanks! That worked.

Also had to add:

name=“{{ item[1].name }}”

to the cron task.
