def resolve_name(target)
      if (group = @group_lookup[target])
        group.node_names
      else
        # Try to wildcard match nodes in inventory
        # Ignore case because hostnames are generally case-insensitive
        regexp = Regexp.new("^#{Regexp.escape(target).gsub('\*', '.*?')}$", Regexp::IGNORECASE)

        nodes = @groups.node_names.select { |node| node =~ regexp }
        nodes += @groups.node_aliases.select { |target_alias, _node| target_alias =~ regexp }.values

        if nodes.empty?
          raise(WildcardError, target) if target.include?('*')
          [target]
        else
          nodes
        end
      end
    end
def resolve_name(target)
      if (group = @group_lookup[target])
        group.node_names
      else
        # Try to wildcard match nodes in inventory
        # Ignore case because hostnames are generally case-insensitive
        regexp = Regexp.new("^#{Regexp.escape(target).gsub('\*', '.*?')}$", Regexp::IGNORECASE)

        nodes = @groups.node_names.select { |node| node =~ regexp }
        nodes += @groups.node_aliases.select { |target_alias, _node| target_alias =~ regexp }.values

        if nodes.empty?
          raise(WildcardError, target) if target.include?('*')
          [target]
        else
          nodes
        end
      end
    end
If target is a group name, expand it to the members of that group.
 Else match against nodes in inventory by name or alias.
 If a wildcard string, error if no matches are found.
 Else fall back to [target] if no matches are found.