code: def configure_roles_on_host(api, host):
    
    for role_ref in host.roleRefs:
      # Mgmt service/role has no cluster name. Skip over those.
      if role_ref.get('clusterName') is None:
        continue
  
      # Get the role and inspect the role type
      role = api.get_cluster(role_ref['clusterName'])\
                .get_service(role_ref['serviceName'])\
                .get_role(role_ref['roleName'])
      LOG.debug("Evaluating %s (%s)" % (role.name, host.hostname))
  
      config = None
      if role.type == 'DATANODE':
        config = DATANODE_CONF
      elif role.type == 'TASKTRACKER':
        config = TASKTRACKER_CONF
      elif role.type == 'REGIONSERVER':
        config = REGIONSERVER_CONF
      else:
        continue
  
      # Set the config
      LOG.info("Configuring %s (%s)" % (role.name, host.hostname))
      role.update_config(config)
docs: Go through all the roles on this host, and configure them if they
    match the role types that we care about.