Empty blocks are not allowed ?

Hi,

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

  vars:
    some: true

  vars_files:

  vars_prompt:

  tasks:
    action: command....

  handlers:

  File "/usr/bin/ansible-playbook", line 100, in <module>
    sys.exit(main(sys.argv[1:]))
  File "/usr/bin/ansible-playbook", line 81, in main
    pb.run()
  File "/usr/lib/python2.6/site-packages/ansible/playbook.py", line
239, in run
    self._run_play(pattern)
  File "/usr/lib/python2.6/site-packages/ansible/playbook.py", line
560, in _run_play
    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)

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!

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

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

– Michael