# playboook syntax?

**URL:** <https://forum.ansible.com/t/playboook-syntax/11568>\
**Category:** Ansible Project\
**Created:** [May 23, 2012, 1:06pm UTC](https://forum.ansible.com/t/playboook-syntax/11568 "2012-05-23T13:06:17Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andreas\_Davour](https://avatars.discourse-cdn.com/v4/letter/a/bcef8e/32.png) [@Andreas\_Davour](https://forum.ansible.com/u/Andreas_Davour)\
**Post date:** [May 23, 2012, 1:06pm UTC](https://forum.ansible.com/t/playboook-syntax/11568/1 "2012-05-23T13:06:17Z")

</div>

I still have some problems with the yaml syntax, or something is broken in the parsing (which seems less likely).

[root@se1ts00x andreasda]# ansible-playbook playbook-tc2-resolver.yaml -k  
SSH password:  
Traceback (most recent call last):  
&nbsp;&nbsp;File "/usr/bin/ansible-playbook", line 100, in \<module\>  
&nbsp;&nbsp;&nbsp;&nbsp;sys.exit(main(sys.argv[1:]))  
&nbsp;&nbsp;File "/usr/bin/ansible-playbook", line 77, in main  
&nbsp;&nbsp;&nbsp;&nbsp;sudo\_pass=sudopass  
&nbsp;&nbsp;File "/usr/lib/python2.6/site-packages/ansible/playbook.py", line 104, in \_\_init\_\_  
&nbsp;&nbsp;&nbsp;&nbsp;self.playbook = self.\_parse\_playbook(playbook)  
&nbsp;&nbsp;File "/usr/lib/python2.6/site-packages/ansible/playbook.py", line 182, in \_parse\_playbook  
&nbsp;&nbsp;&nbsp;&nbsp;playbook = utils.parse\_yaml\_from\_file(playbook)  
&nbsp;&nbsp;File "/usr/lib/python2.6/site-packages/ansible/utils.py", line 265, in parse\_yaml\_from\_file  
&nbsp;&nbsp;&nbsp;&nbsp;return parse\_yaml(data)  
&nbsp;&nbsp;File "/usr/lib/python2.6/site-packages/ansible/utils.py", line 258, in parse\_yaml  
&nbsp;&nbsp;&nbsp;&nbsp;return yaml.load(data)  
&nbsp;&nbsp;File "/usr/lib64/python2.6/site-packages/yaml/\_\_init\_\_.py", line 58, in load  
&nbsp;&nbsp;&nbsp;&nbsp;return loader.get\_single\_data()  
&nbsp;&nbsp;File "/usr/lib64/python2.6/site-packages/yaml/constructor.py", line 42, in get\_single\_data  
&nbsp;&nbsp;&nbsp;&nbsp;node = self.get\_single\_node()  
&nbsp;&nbsp;File "/usr/lib64/python2.6/site-packages/yaml/composer.py", line 36, in get\_single\_node  
&nbsp;&nbsp;&nbsp;&nbsp;document = self.compose\_document()  
&nbsp;&nbsp;File "/usr/lib64/python2.6/site-packages/yaml/composer.py", line 55, in compose\_document  
&nbsp;&nbsp;&nbsp;&nbsp;node = self.compose\_node(None, None)  
&nbsp;&nbsp;File "/usr/lib64/python2.6/site-packages/yaml/composer.py", line 82, in compose\_node  
&nbsp;&nbsp;&nbsp;&nbsp;node = self.compose\_sequence\_node(anchor)  
&nbsp;&nbsp;File "/usr/lib64/python2.6/site-packages/yaml/composer.py", line 111, in compose\_sequence\_node  
&nbsp;&nbsp;&nbsp;&nbsp;node.value.append(self.compose\_node(node, index))  
&nbsp;&nbsp;File "/usr/lib64/python2.6/site-packages/yaml/composer.py", line 84, in compose\_node  
&nbsp;&nbsp;&nbsp;&nbsp;node = self.compose\_mapping\_node(anchor)  
&nbsp;&nbsp;File "/usr/lib64/python2.6/site-packages/yaml/composer.py", line 133, in compose\_mapping\_node  
&nbsp;&nbsp;&nbsp;&nbsp;item\_value = self.compose\_node(node, item\_key)  
&nbsp;&nbsp;File "/usr/lib64/python2.6/site-packages/yaml/composer.py", line 82, in compose\_node  
&nbsp;&nbsp;&nbsp;&nbsp;node = self.compose\_sequence\_node(anchor)  
&nbsp;&nbsp;File "/usr/lib64/python2.6/site-packages/yaml/composer.py", line 110, in compose\_sequence\_node  
&nbsp;&nbsp;&nbsp;&nbsp;while not self.check\_event(SequenceEndEvent):  
&nbsp;&nbsp;File "/usr/lib64/python2.6/site-packages/yaml/parser.py", line 93, in check\_event  
&nbsp;&nbsp;&nbsp;&nbsp;self.current\_event = self.state()  
&nbsp;&nbsp;File "/usr/lib64/python2.6/site-packages/yaml/parser.py", line 398, in parse\_indentless\_sequence\_entry  
&nbsp;&nbsp;&nbsp;&nbsp;if self.check\_token(BlockEntryToken):  
&nbsp;&nbsp;File "/usr/lib64/python2.6/site-packages/yaml/scanner.py", line 116, in check\_token  
&nbsp;&nbsp;&nbsp;&nbsp;self.fetch\_more\_tokens()  
&nbsp;&nbsp;File "/usr/lib64/python2.6/site-packages/yaml/scanner.py", line 220, in fetch\_more\_tokens  
&nbsp;&nbsp;&nbsp;&nbsp;return self.fetch\_value()  
&nbsp;&nbsp;File "/usr/lib64/python2.6/site-packages/yaml/scanner.py", line 580, in fetch\_value  
&nbsp;&nbsp;&nbsp;&nbsp;self.get\_mark())  
yaml.scanner.ScannerError: mapping values are not allowed here  
&nbsp;&nbsp;in "\<string\>", line 6, column 11:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;action: template src=/root/andreasda/r ...  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;^  
[root@se1ts00x andreasda]# cat playbook-tc2-resolver.yaml

---

<div class="post-metadata">

**Author:** ![Dominik\_Sander](https://avatars.discourse-cdn.com/v4/letter/d/ce7236/32.png) [@Dominik\_Sander](https://forum.ansible.com/u/Dominik_Sander)\
**Post date:** [May 23, 2012, 1:21pm UTC](https://forum.ansible.com/t/playboook-syntax/11568/2 "2012-05-23T13:21:43Z")

</div>

Hi,

the error message is a bit misleading, your error is actually on line 5,  
you missed a “:” after the “name” attribute. Here is the corrected version  
of your yaml:

---

<div class="post-metadata">

**Author:** ![Andreas\_Davour](https://avatars.discourse-cdn.com/v4/letter/a/bcef8e/32.png) [@Andreas\_Davour](https://forum.ansible.com/u/Andreas_Davour)\
**Post date:** [May 23, 2012, 1:50pm UTC](https://forum.ansible.com/t/playboook-syntax/11568/3 "2012-05-23T13:50:04Z")

</div>

Many thanks! I have been staring at that yaml example on the gihub page and still I did not see that missing colon.

Oddly, I get these errors, even though the templating works just fine, since I can see it when I run "ansible -m command -a 'ls -l /tmp/resolv.conf'".

failed: [frostdw01.tc2] =\> copy src=/var/tmp/ansible.jWg694/source dest=/tmp/resolv.conf =\> {"changed": true, "failed": true, "md5sum": "42f278b0052ab986d21f12a1b2b5f7a5", "msg": "", "parsed": false}

stderr: [frostdw01.tc2] =\> Traceback (most recent call last):

&nbsp;&nbsp;File "/var/tmp/ansible.jWg694/file", line 294, in ?

&nbsp;&nbsp;&nbsp;&nbsp;changed = set\_context\_if\_different(path, secontext, changed)

&nbsp;&nbsp;File "/var/tmp/ansible.jWg694/file", line 182, in set\_context\_if\_different

&nbsp;&nbsp;&nbsp;&nbsp;debug("current secontext is %s" % ':'.join(cur\_context))

TypeError: sequence item 0: expected string, NoneType found

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [May 23, 2012, 1:54pm UTC](https://forum.ansible.com/t/playboook-syntax/11568/4 "2012-05-23T13:54:58Z")

</div>

The debug line should definitely be removed then.

This is 0.3 or 0.4 (devel)?

–Michael

---

<div class="post-metadata">

**Author:** ![Andreas\_Davour](https://avatars.discourse-cdn.com/v4/letter/a/bcef8e/32.png) [@Andreas\_Davour](https://forum.ansible.com/u/Andreas_Davour)\
**Post date:** [May 23, 2012, 2:16pm UTC](https://forum.ansible.com/t/playboook-syntax/11568/5 "2012-05-23T14:16:03Z")

</div>

That is 0.3.1 which I guess mean I should try 0.4 to see if it differ. I will update as soon as the new rpm is ouyt, since this is on a RHEL 6 machine. (Yeah, I have way too many differing machines in my server park...)

-andreas

---

<div class="post-metadata">

**Author:** ![Andreas\_Davour](https://avatars.discourse-cdn.com/v4/letter/a/bcef8e/32.png) [@Andreas\_Davour](https://forum.ansible.com/u/Andreas_Davour)\
**Post date:** [May 23, 2012, 2:35pm UTC](https://forum.ansible.com/t/playboook-syntax/11568/6 "2012-05-23T14:35:32Z")

</div>

Ah, I had a git clone on that machine already. Yes, 0.4 works fine.

-andreas
