This error got fixed when i moved the section under tasks to a different YML file and included that file in this one and it worked :)
Although i got moved to new error now
TASK: [Wildfly container#1] ***************************************************
failed: [159.203.249.12] => {"error": "NotFound(HTTPError(u'404 Client Error: Not Found for url: http+docker://localunixsocket/v1.20/images/create?tag=latest&fromImage=jboss%2Fwildfly',),)", "failed": true}
msg: Failed to pull the specified image: jboss/wildfly
Doing 'docker pull jboss/wildfly' directly on the host works fine.
Thanks
-Kunal