(やく) A role. Use this about actors  (役を演ずる:play a role!)  Also used about businessmen who hold a certain post of position (役を務める). That’s right:this kanji means ‘formal post or position’, not just role. 役 is used negatively too, in the set expression 役に立たない人 (a useless person!).
(やくわり) Role, but more informal and figurative than 役. Gay dudes who are top or bottom – that’s 役割. If your role is ‘the black sheep of the family,’ that’s 役割.  The guy in the boy-band who is “the edgy one.” The person on the reality -TV show who is “the crazy one.”   $$$