I had a playbook fail because of the error dict object has no element
It took me ages to debug it, but the problem is that I had defined the index as a string, but was trying to match it to a number. To fix it, I only had to quote the version in the inventory, and everything worked.
I was only caught by this because I was using an old inventory file to test with. I think it used to automatically cast numbers to string, but that stopped a while ago.