So far in Arma Reforger and (at least) in official missions that have been made available during the 'reforging', the recipe for player slotting in scenarios goes like so: players join a faction, then a group and then select a 'loadout' from those that have been made available for the faction as a whole. Usually selection of a loadout has not been restricted and due to that every player in a single group can be eg. a machine gunner or a sharpshooter.
As far as I have come to understand there is no readily available solution which would make possible to create missions where players select a role that is specifically available for the group that the player has joined. At present there is at least one community mod with which to achieve something like that but it comes with its custom UI and whatnot changes: things that necessarily aren't needed by everyone (as always, depends who we are asking). Testing with the mod also shows signs that it doesn't work with vanilla ScenarioFramework task creation functionality and instead has a built-in system with which to create tasks.
Going forward with Arma Reforger and slowly moving to the next installment (Arma 4??), introduce a native solution for slot selection based on roles within a group somewhere along the road.
Looking from the perspective of mission creators one way for creating the functionality could be like so: a mission creator is able to just plop in playable groups into a mission that's being created in Workbench. These groups would then become available as such in the role selection screen. In the role selection screen players would then be able to select a specific role from the available groups.