Hi all,
I was trying to update ansible from 1.2 to 1.5 and noticed that I can no longer use "only_if" which has been replaced by "when".
But when I try to run a shell task with this condition:
when: "len(filter(lambda m: m['mount'] == '/var/lib/myMount', '{{ansible_mounts}}')) == 0"
I get the following error:
error while evaluating conditional: len(filter(lambda m: m['mount'] == '/var/lib/myMount', '[{u'size_total':
8455118848, u'mount': u'/', u'size_available': 6891151360, u'fstype': u'ext4', u'device': u'/dev/xvda1', u'options': u'rw'}, {u'size_total':
16122802176, u'mount': u'/mnt', u'size_available':
15129432064, u'fstype': u'ext3', u'device': u'/dev/xvdb', u'options': u'rw,_netdev'}, {u'size_total': 107321753600, u'mount': u'/var/lib/myMount', u'size_available': 107250851840, u'fstype': u'xfs', u'device': u'/dev/xvdf', u'options': u'rw,noatime'}]')) == 0
The ansible_mounts variable is being correctly returned as you can see in the error message.
I've tryed different combinations of positioning the quote marks but no luck.
Any help?
Regards,
Douglas