code: def get_nodes_with_role(role_name, environment=None):
      
      prefix_search = role_name.endswith("*")
      if prefix_search:
          role_name = role_name.rstrip("*")
      for n in get_nodes(environment):
          roles = get_roles_in_node(n, recursive=True)
          if prefix_search:
              if any(role.startswith(role_name) for role in roles):
                  yield n
          else:
              if role_name in roles:
                  yield n
docs: Get all nodes which include a given role,
      prefix-searches are also supported