# How to specify Vagrantfile?

**URL:** <https://discuss.hashicorp.com/t/how-to-specify-vagrantfile/11743>\
**Category:** Packer\
**Created:** [July 21, 2020, 5:50am UTC](https://discuss.hashicorp.com/t/how-to-specify-vagrantfile/11743 "2020-07-21T05:50:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![falconws](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/falconws/32/9630_2.png) [@falconws](https://discuss.hashicorp.com/u/falconws)\
**Post date:** [July 21, 2020, 5:50am UTC](https://discuss.hashicorp.com/t/how-to-specify-vagrantfile/11743/1 "2020-07-21T05:50:19Z")

</div>

I have created my Vagrantfile below

```auto
Vagrant.configure("2") do |config|
  config.vm.box = "bento/ubuntu-18.04"
  config.vm.network "forwarded_port", guest: 8080, host: 8080
  config.vm.network "forwarded_port", guest: 5901, host: 5901

  config.vm.provider "virtualbox" do |vb|
    # Display the VirtualBox GUI when booting the machine
    vb.gui = false

    # Customize the amount of memory on the VM:
    vb.memory = "2560"

  end
end

```

I want to use this Vagrantfile for created box.  
My packer template JSON file is below

packer\_template.json

```auto
{
  "builders": [
    {
      "communicator": "ssh",
      "source_path": "bento/ubuntu-18.04",
      "provider": "virtualbox",
      "type": "vagrant",
      "output_vagrantfile": "Vagrantfile"
    }
  ],
  "provisioners": [
    {
      "type": "shell",
      "script": "packer_script.sh"
    },
    {
      "type": "ansible-local",
      "playbook_file": "site.yml",
      "playbook_dir": "."
    }
  ]
}

```

Run `packer build packer_template.json`. This result is created output-vagrant directory.  
This directory included Vagrantfile below

```auto
Vagrant.configure("2") do |config|
  config.vm.define "source", autostart: false do |source|
        source.vm.box = "bento/ubuntu-18.04"
        config.ssh.insert_key = false
  end
  config.vm.define "output" do |output|
        output.vm.box = "packer_vagrant"
        output.vm.box_url = "file://package.box"
        config.ssh.insert_key = false
  end
  config.vm.synced_folder ".", "/vagrant", disabled: true
end

```

So, executing `vagrant up` is launch `output` VM.  
Then `vagrant ssh` result is `This command requires a specific VM name to target in a multi-VM environment.`.

I’m using Packer v1.6.0.

Question:

1. I want to `vagrant up` -\> `vagrant ssh` without specify VM name.
2. I want to use my Vagrantfile instead of the defined `source` and `output` VM.

How to?  
Am I wrong?

Thanks.
