def insert_system_roles():
    """
    Migration which inserts the default system roles.
    """
    system_roles = SystemRole.get_valid_values()

    LOG.debug("Inserting system roles (%s)" % (str(system_roles)))

    for role_name in system_roles:
        description = role_name
        role_db = RoleDB(name=role_name, description=description, system=True)

        try:
            role_db.save()
        except (StackStormDBObjectConflictError, NotUniqueError):
            # Role already exists error is not fatal
            pass

    Migration which inserts the default system roles.
    
st2common/st2common/rbac/migrations.py