def build(template, options = {})
      args = ['build', '-machine-readable']
      args << '-force' if options.key?(:force)
      args << "-except=#{options[:except].join(',')}" if options.key?(:except)
      args << "-only=#{options[:only].join(',')}" if options.key?(:only)
      args << "-parallel=#{options[:parallel]}" if options.key?(:parallel)
      args << "-var-file=#{options[:var_file]}" if options.key?(:var_file)

      vars = options[:vars] || {}
      vars.each { |key, val| args << "-var '#{key}=#{val}'" }

      args << template

      Packer::Output::Build.new(
        command(args, options[:live_stream]))
    end
def build(template, options = {})
      args = ['build', '-machine-readable']
      args << '-force' if options.key?(:force)
      args << "-except=#{options[:except].join(',')}" if options.key?(:except)
      args << "-only=#{options[:only].join(',')}" if options.key?(:only)
      args << "-parallel=#{options[:parallel]}" if options.key?(:parallel)
      args << "-var-file=#{options[:var_file]}" if options.key?(:var_file)

      vars = options[:vars] || {}
      vars.each { |key, val| args << "-var '#{key}=#{val}'" }

      args << template

      Packer::Output::Build.new(
        command(args, options[:live_stream]))
    end
Executes +packer build+.

 Will execute multiple builds in parallel as defined in the template.
 The various artifacts created by the template will be outputted.

 @param [String,Packer::Template] template the Packer template
 @param [Hash] options
 @option options [Boolean] :force force a build to continue if artifacts
   exist, deletes existing artifacts
 @option options [Array<String>] :except build all builds other than
   these
 @option options [Array<String>] :only only build the given builds by
   name
 @option options [Boolean] :parallel disable parallelization (on by
   default)
 @option options [Hash] :vars variables for templates
 @option options [String] :var_file path to JSON file containing user
   variables
 @option options [IO] :live_stream an IO object to stream packer output to
   in addition to saving output in the output object.
 @return [Packer::Output::Build]