# Playbook help - syntax

**URL:** <https://forum.ansible.com/t/playbook-help-syntax/21554>\
**Category:** Ansible Developer\
**Tags:** windows\
**Created:** [May 24, 2016, 6:35pm UTC](https://forum.ansible.com/t/playbook-help-syntax/21554 "2016-05-24T18:35:09Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bud\_Calabrese](https://avatars.discourse-cdn.com/v4/letter/b/8dc957/32.png) [@Bud\_Calabrese](https://forum.ansible.com/u/Bud_Calabrese)\
**Post date:** [May 24, 2016, 6:35pm UTC](https://forum.ansible.com/t/playbook-help-syntax/21554/1 "2016-05-24T18:35:09Z")

</div>

I am working on a Ansible file that will update our Windows boxes instead of using SCCM. I keep getting an error. Here is my playbook.

```auto
---
- hosts: Windows
  connection: winrm
  tasks:
    - name: Install Critical Updates
      win_updates:
        category_names:
          - CriticalUpdates
        log_path= "c:/temp/ansible_wu.txt"
    - name: Reboot Servers
      raw: shutdown.exe /r /t 10  
The error is:ERROR! Syntax Error while loading YAML.

The error appears to have been in '/home/bud/ansible/WinUpdate.yml': line 13, column 5, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

- name: Restart machine
^ here

```

---

<div class="post-metadata">

**Author:** ![willthames](https://avatars.discourse-cdn.com/v4/letter/w/8dc957/32.png) [@willthames](https://forum.ansible.com/u/willthames)\
**Post date:** [May 25, 2016, 1:09am UTC](https://forum.ansible.com/t/playbook-help-syntax/21554/2 "2016-05-25T01:09:14Z")

</div>

This is a question for the ansible-project list rather than ansible-devel.

The playbook you’ve posted doesn’t appear complete, as the error message relates to a task name that isn’t in the below playbook (this is feedback so that you can have better luck in ansible-project)

---

<div class="post-metadata">

**Author:** ![j.r.hawkesworth](https://avatars.discourse-cdn.com/v4/letter/j/a3d4f5/32.png) [@j.r.hawkesworth](https://forum.ansible.com/u/j.r.hawkesworth)\
**Post date:** [May 25, 2016, 5:23am UTC](https://forum.ansible.com/t/playbook-help-syntax/21554/3 "2016-05-25T05:23:02Z")

</div>

Yes, Will is right, this is really a question for ansible-project.

However, it looks to me like you have an = where there should be a : in

```auto
log_path= "c:/temp/ansible_wu.txt"

```

should be

log\_path: “C:/temp/ansible\_wu.txt”

Single line ansible module calls can use the key=value key=value syntax, but when you are using the multi-line yaml style syntax it needs to be key: value

[yamllint.com](http://yamllint.com) or a yaml-aware text editor can be a help when you are getting used to writing playbooks.

All the best,

Jon

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [May 25, 2016, 8:52am UTC](https://forum.ansible.com/t/playbook-help-syntax/21554/4 "2016-05-25T08:52:12Z")

</div>

> Single line ansible module calls can use the key=value key=value syntax,  
> but when you are using the multi-line yaml style syntax it needs to be key:  
> value

This statement is not correct.

> yamllint.com or a yaml-aware text editor can be a help when you are getting  
> used to writing playbooks.

Code like this work  
- name: Update the Apache config  
&nbsp;&nbsp;&nbsp;copy: \>  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;src=httpd.conf  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dest=/etc/httpd/httpd.conf

Even dropping the bigger than and it works, also yamllint.com says it is valid.

More about multiline here  
[https://support.ansible.com/hc/en-us/articles/201957837-How-do-I-split-an-action-into-a-multi-line-format-](https://support.ansible.com/hc/en-us/articles/201957837-How-do-I-split-an-action-into-a-multi-line-format-)

---

<div class="post-metadata">

**Author:** ![j.r.hawkesworth](https://avatars.discourse-cdn.com/v4/letter/j/a3d4f5/32.png) [@j.r.hawkesworth](https://forum.ansible.com/u/j.r.hawkesworth)\
**Post date:** [May 25, 2016, 7:02pm UTC](https://forum.ansible.com/t/playbook-help-syntax/21554/5 "2016-05-25T19:02:37Z")

</div>

Kai,

Thanks for this, I didn’t know that should make converting ad hoc ansible command into playbook style entries easier.  
Stylistically I wouldn’t want to mix key: value and key=value though as in the example above.

Jon
