# Empty blocks are not allowed ?

**URL:** <https://forum.ansible.com/t/empty-blocks-are-not-allowed/11584>\
**Category:** Ansible Project\
**Created:** [May 29, 2012, 11:37am UTC](https://forum.ansible.com/t/empty-blocks-are-not-allowed/11584 "2012-05-29T11:37:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ansibleguest](https://avatars.discourse-cdn.com/v4/letter/a/b4bc9f/32.png) [@ansibleguest](https://forum.ansible.com/u/ansibleguest)\
**Post date:** [May 29, 2012, 11:37am UTC](https://forum.ansible.com/t/empty-blocks-are-not-allowed/11584/1 "2012-05-29T11:37:06Z")

</div>

Hi,

found that if you have the blocks from a playbook template and you  
leave the blocks empty you get python errors ☹

&nbsp;&nbsp;vars:  
&nbsp;&nbsp;&nbsp;&nbsp;some: true

&nbsp;&nbsp;vars\_files:

&nbsp;&nbsp;vars\_prompt:

&nbsp;&nbsp;tasks:  
&nbsp;&nbsp;&nbsp;&nbsp;action: command....

&nbsp;&nbsp;handlers:

&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 81, in main  
&nbsp;&nbsp;&nbsp;&nbsp;pb.run()  
&nbsp;&nbsp;File "/usr/lib/python2.6/site-packages/ansible/playbook.py", line  
239, in run  
&nbsp;&nbsp;&nbsp;&nbsp;self.\_run\_play(pattern)  
&nbsp;&nbsp;File "/usr/lib/python2.6/site-packages/ansible/playbook.py", line  
560, in \_run\_play  
&nbsp;&nbsp;&nbsp;&nbsp;if len(vars\_files) \> 0:

It should just skip them when they are empty i would recommend...

(ansible-0.3.1-1.el6, Centos 6.2)

---

<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 29, 2012, 12:08pm UTC](https://forum.ansible.com/t/empty-blocks-are-not-allowed/11584/2 "2012-05-29T12:08:19Z")

</div>

I agree.

I will file a bug to take a look at this for 0.5 (and maybe someone wants to back port to 0.4) since I agree it would be nice to leave them in for documentation  
purposes sometime. 0.3 will not be seeing any updates since it is the previous release – we will probably be updating EPEL to 0.4.1 or so soon.

Thanks!

---

<div class="post-metadata">

**Author:** ![Jeffrey\_Damick](https://avatars.discourse-cdn.com/v4/letter/j/3bc359/32.png) [@Jeffrey\_Damick](https://forum.ansible.com/u/Jeffrey_Damick)\
**Post date:** [June 5, 2012, 3:37pm UTC](https://forum.ansible.com/t/empty-blocks-are-not-allowed/11584/3 "2012-06-05T15:37:23Z")

</div>

Along the same lines, I was wondering about how to specify empty actions? Let’s say I am reusing a task that has a notify in it, but in this particular playbook I want the action to do nothing or ignore the notify, how can specify this? right now i’m just sending: command true, but that’s a bit of a kludge…

thanks,  
-jeff

---

<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:** [June 5, 2012, 9:07pm UTC](https://forum.ansible.com/t/empty-blocks-are-not-allowed/11584/4 "2012-06-05T21:07:18Z")

</div>

I don’t know what “ignore the notify” would mean.

– Michael
