Questions tagged [vagrantfile]

Vagrantfiles are configuration files for vagrant. The Vagrantfile describes the type of virtual machine, and how to configure and provision the vm.

The primary function of the Vagrantfile is to describe the type of machine required for a project, and how to configure and provision these machines. Vagrantfile are called Vagrantfiles because the actual literal filename for the file is Vagrantfile (casing doesn't matter).

Vagrant is meant to run with one Vagrantfile per project, and the Vagrantfile is supposed to be committed to version control. This allows other developers involved in the project to check out the code, run vagrant up, and be on their way. Vagrantfiles are portable across every platform Vagrant supports.

The syntax of Vagrantfiles is , but knowledge of the programming language is not necessary to make modifications to the Vagrantfile, since it is mostly simple variable assignment. In fact, isn't even the most popular community Vagrant is used within, which should help show you that despite not having Ruby knowledge, people are very successful with Vagrant.

1000 questions
5
votes
0 answers

How to stop vagrant from having to re-download the image on every "vagrant up" on Windows?

When I run vagrant up on Windows the first time, I expect it to download then cache the box. But if I run vagrant halt followed by vagrant up I end up having to wait 15 minutes for the machine to be downloaded and re-assembled; When I ran vagrant…
leeand00
  • 25,510
  • 39
  • 140
  • 297
5
votes
1 answer

How to setup postgres config from vagrantfile

I want to create a postgres user and then create a table with certain schema specification. Is there a way to do that through Vagrantfile? My Vagrantfile has inline provisioning script. I tried searching on google but everything available was…
vjdhama
  • 4,878
  • 5
  • 33
  • 47
5
votes
4 answers

Correct "config.ssh.shell" value for vagrant windows box?

I'm starting vagrant box with Windows 7 from host which is also Windows 7 with "vagrant up" command. Contents of Vagrantfile: Vagrant.configure(2) do |config| config.vm.box = "win7_base_test" config.vm.network "forwarded_port", guest: 88, host:…
Viktor Malyi
  • 2,298
  • 2
  • 23
  • 40
5
votes
2 answers

how to unlock a vagrant machine while it is being provisioned

Our vagrant box takes ~1h to provision thus when vagrant up is run for the first time, at the very end of provisioning process I would like to package the box to an image in a local folder so it can be used as a base box next time it needs to be…
Vigintas Labakojis
  • 1,039
  • 1
  • 15
  • 21
5
votes
1 answer

How to detect which OS type the current guest is in the Vagrantfile

I'd like to have one Vagrantfile for multiple different OS types (e.g. windows and linux). I'm currently attempting to do something like this: ... if config.vm.guest.to_s == "windows" # ... do something windows specific else # ... do…
d0c_s4vage
  • 3,947
  • 6
  • 23
  • 32
5
votes
1 answer

Why is Vagrant port forwarding not working

I have a Vagrant box with JBoss. I'm trying to forward two ports. My Vagrantfile has the following for that web.vm.network "forwarded_port", guest: 8080, host: 8080 # jboss web.vm.network "forwarded_port", guest: 9990, host: 9990 # jboss management…
onknows
  • 6,151
  • 12
  • 65
  • 109
5
votes
4 answers

Vagrant, Flask — App not running on 10.10.10.10, 127.0.0.1

I'm running an app on my local box via Vagrant. The Python/Flask app launches and prints: * Running on http://127.0.0.1:5000/ * Restarting with reloader I found this…
tmthyjames
  • 1,588
  • 2
  • 22
  • 30
5
votes
0 answers

IntelliJ IDEA doesn't recognise Vagrant properties when editing Vagrantfile

I'm using IDEA 14 and have installed Ruby support to get syntax colouring for Vagrantfiles. Unfortunately it now complains about missing properties. From my very limited understanding of Ruby I think need to import some sort of dependency (Gem?)…
Swav
  • 841
  • 8
  • 24
5
votes
3 answers

how to add aliases to vagrant vm .bashrc file

I'm trying to provision a vm with some alias and keep getting permision denied, wondering what the proper way of doing this is: end of Vagrant file (this works): config.vm.provision :shell, :path => "provision.sh" in provision.sh: echo "alias…
dismal
  • 133
  • 1
  • 9
5
votes
1 answer

Vagrant folder permissions using nginx

I am new to vagrant and having issues getting working correctly. It is running fine with port forwarding and I can access it. However I am having trouble getting bower and gulp to work correctly. The issue seems to stem from the /var/www directory…
JeremyC
  • 241
  • 4
  • 14
5
votes
1 answer

How to include and reference a custom ssh key in a vagrant base (baseline) box? (virtualbox)

In vagrant documentation i did not found a hint on how to reference an included file from a included Vagrantfile within the same baseline box when using "vagrant package". Can anyone help? Details: When creating a new baseline box from scratch for…
DanielaWaranie
  • 1,405
  • 1
  • 17
  • 22
5
votes
0 answers

url rewriting is not working (with Apache on Vagrant)

I am trying to make a simple server for local PHP development with Vagrant on mac OS 10.9.4. Vagrant is running inside the main "~/Sites" directory with "/var/www/html" on the guest pointing there. The Vagrantfile looks like this: config.vm.box =…
François Romain
  • 13,617
  • 17
  • 89
  • 123
5
votes
2 answers

Setting ENV vars from host to guest in Vagrant

Is there any way that I can set some ENV vars from host to guest Vagrant OS when booting it up? From my guest OS I need to connect to a database and I want to pass the database URL from host to guest as well as other parameters. I tried with…
Romeo Mihalcea
  • 9,714
  • 12
  • 50
  • 102
4
votes
3 answers

GPG error public key is not available: NO_PUBKEY B53DC80D13EDEF05: during VM creation using Vagrant

I am trying to install a K8s cluster VM nodes using Vagrant and relevant install shell script (listed below). I tried some of the suggestions in similar questions, but they did not help my case. I am using virtualbox version 6.1.40 on Windows…
AnilJ
  • 1,951
  • 2
  • 33
  • 60
4
votes
2 answers

Vagrant Up VAB: Warning: Remote connection disconnect. Retrying

Anyone know what is going on with Vagrant? Using Windows 10, VScode, Virtualbox 6.1.10 i have done googling and not found anything helpful one person said to Use config.ssh.insert_key = false in your Vagrantfile and then try. but doing so did not…