Remove the spaces. You are now setting a value to the environment variable role (with a trailing space that Stack Overflow won't show). Also, the role becomes "admin" (including quotes and a leading space, that is, again, not visible here).
You can verify this by running set without parameters from the command line. It will give you a list of all variables, in which you can clearly see the undesired spaces.
if "%username%" == "admin" (
set role=admin
) else (
set role=user
)
echo %role%
The only reason you still need quotes with an if statement, is that the statement would become invalid if %username% didn't exist/was empty. In that case, the line would become:
if == admin (
... Which is of course invalid. It doesn't even need to be quotes, you could also write:
if %username%XYZ == adminXYZ (