Added additional error checking to avoid HTTP400 responses from ansible.