# Syntax Error while loading YAML script, cron.yml

**URL:** <https://forum.ansible.com/t/syntax-error-while-loading-yaml-script-cron-yml/16141>\
**Category:** Ansible Project\
**Created:** [September 8, 2014, 4:17am UTC](https://forum.ansible.com/t/syntax-error-while-loading-yaml-script-cron-yml/16141 "2014-09-08T04:17:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chris\_Olido](https://avatars.discourse-cdn.com/v4/letter/c/ea5d25/32.png) [@Chris\_Olido](https://forum.ansible.com/u/Chris_Olido)\
**Post date:** [September 8, 2014, 4:17am UTC](https://forum.ansible.com/t/syntax-error-while-loading-yaml-script-cron-yml/16141/1 "2014-09-08T04:17:25Z")

</div>

I am creating a cron playbook, my code is as follow.

* * *

# Creates an entry like “\* 5,2 \* \* ls -alh \> /dev/null”

- cron: name=“daily\_stats” hour=“\* 12 \* \* \*” job=“/home/ec2-user/send\_report\_stats.sh”

and change to

# Creates an entry like “\* 5,2 \* \* ls -alh \> /dev/null”

- Name Creates cron job to run the reports.

cron: name=“daily\_stats” hour=“\* 12 \* \* \*” job=“/home/ec2-user/send\_report\_stats.sh”

* * *

SNOTRA:TimePhone chrisolido$ ansible-playbook -i hosts cron.yml --check

ERROR: Syntax Error while loading YAML script, cron.yml

Note: The error may actually appear before this position: line 11, column 87

# Creates an entry like “\* 5,2 \* \* ls -alh \> /dev/null”

- cron: name=“daily\_stats” hour=“\* 12 \* \* \*” job=“/home/ec2-user/send\_report\_stats.sh”

^

We could be wrong, but this one looks like it might be an issue with

unbalanced quotes. If starting a value with a quote, make sure the

line ends with the same set of quotes. For instance this arbitrary

example:

foo: “bad” “wolf”

Could be written as:

foo: ‘“bad” “wolf”’

I tried following the example always having the same error.

TIA,

Chris

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [September 8, 2014, 1:21pm UTC](https://forum.ansible.com/t/syntax-error-while-loading-yaml-script-cron-yml/16141/2 "2014-09-08T13:21:53Z")

</div>

I’m missing the following example part you tried, but when you have:

- cron: name=“daily\_stats” hour=“\* 12 \* \* \*” job=“/home/ec2-user/send\_report\_stats.sh”

One of these is:

- cron: ‘name=“daily\_stats” hour=“\* 12 \* \* \*” job=“/home/ec2-user/send\_report\_stats.sh”’

Or even:

- cron:

name: “daily\_stats”

hour: “\* 12 \* \* \*”

job: “/home/ec2-user/send\_report\_stats.sh”

Which can be simplified to:

- cron:

name: daily\_stats

hour: “\* 12 \* \* \*”

job: /home/ec2-user/send\_report\_stats.sh

Though the simplest thing is to just leave off quotes:

- cron: name=daily\_stats hour=“\* 12 \* \* \*” job=/home/ec2-user/send\_report\_stats.sh
