Does "part" mean the same thing in these two sentences?

She played the part of Desdemona.

We all have a part to play.
the same meaning