As described in the github issue hyperlinked in the question, the version I wanna use this with, is

ansible==1.9.6

.

@konstantin-suvorov's answer below works with ansible 2.1+ following jinja templating's comment system. In case you're wondering how to get around this problem of getting length of the array with older ansible versions, this one-liner might help: