The resource profiles contain lists of servers. Those lists are aggregated and flattened as part of the role initialization, so once you're within a role there is currently no way to know which server came from which role. All server groupings are based solely on the properties within the property dictionary, so you could set a RESOURCE_PROFILE property on each server, but then you have to keep it up to date as servers are moved around.
A slightly more automated way to track and maintain this over time might be to write a BLCLI script that pulls data from the users file and populates a ROLE property. Something along the lines of this (run in a runcmd format):
ROLES=`cat /usr/lib/rsc/users | fields -d ":" 1`
foreach role in "$ROLES"
Check to see if role has been added to the string
echo $ROLE_PROP_VAL | grep -q $role
if test "$?" -ne "0"
PROP_KEY=`blcli Property getDBKeyFromPropertyName ROLE_LIST` (or whatever the BLCLI call is to perform this)
blcli Server addPropertyValue $SERVER_ID $PROP_KEY $ROLE_PROP_VAL
And then your smart groups could be structured along the lines of "ROLE_LIST contains "CMAdmins" or whatever the role name is.
Create a role that only uses that resource profile. Then set a server property such as PRIMARY_RESOURCE_PROFILE. Run a job against all hosts from that resource profile restricted role which sets the value for the property. Then, when you go back to your master role you can create smart groups that filter based on the value of that property.
This only works if your servers are each in a single primary resource group and your master role's aggregates resource profiles to get its host list. We do this by environment:
PR_hosts, QA_hosts, DV_hosts and CERT_hosts. We pass out admin (root) privileges to certain groups on those resource profiles and also have an "All Hosts" root role that rolls them all up. I would love to work with smart groups within the All Hosts role that was based on the resource profile the host came in under. CUrrently we switch roles to accomodate this need, but I think I will set up what I described above.