migrations/RbacMigration.php
function createRole($name, $description) {
        if ($user = $this->authManager->getRole($name)) {
            echo "{$name} role already exists\n";
        } else {
            $user = $this->authManager->createRole($name);
            $user->description = $description;
            $this->authManager->add($user);
            echo "{$name} role created\n";
        }
        return $user;
    }
function createRole($name, $description) {
        if ($user = $this->authManager->getRole($name)) {
            echo "{$name} role already exists\n";
        } else {
            $user = $this->authManager->createRole($name);
            $user->description = $description;
            $this->authManager->add($user);
            echo "{$name} role created\n";
        }
        return $user;
    }
Create role.
If role already exists doesn nothing.

@param string $name Role name
@param string $description Role description
@return \yii\rbac\Permission the new Permission object