npm install serialize-ansible-tasks-output
const { serializeTasksOutputs } = require("serialize-ansible-tasks-output");
const tasks = serializeTasksOutputs('YOUR_LOG_OUTPUT');
const failedTasks = tasks.filter(p => p.isError);
console.log({ failedTasks });