Assign a user role to a membership when registering

Hello,

I cant figure out how to assign a specific user role to a membership level when the user signs up? Could someone please point me in the right direction.

Also is there a way to bulk change a user role based on a membership subscription for all users in that subscription?

Thanks
William