Syntax Error while loading YAML script, cron.yml

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

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