Solved it! (found the answer here) and thought I would post it the results, just in case it helps someone: I should
// Get an array of roles
$roles = user_roles();
first (inside the function, before $newuser array), and then,
'roles' => array(array_search('myrolename', $roles) => 1),
There, it works like a charm.