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
9
votes
2 answers

Vagrant IP address setup for port listening

I run this command inside my vagrant instance: printf 'HTTP/1.1 302 Moved\r\nLocation: https://www.eff.org/' | nc -l 2345 On my host computer, I want to access :2345 and be redirected to https://www.eff.org/. Redirect does…
Uylenburgh
  • 1,277
  • 4
  • 20
  • 46
9
votes
2 answers

Is it possible to load a Vagrantfile config from within another Vagrantfile?

Vagrant Multi-Machine functionality seems pretty cool, however one thing that bothers me (or is isn't immediately apparent) is that there doesn't seem to be a good way to share configuration options between a "parent" Vagrantfile and "children"…
jamesconant
  • 1,405
  • 1
  • 12
  • 18
9
votes
1 answer

How to automatically install Ansible Galaxy roles, using Vagrant?

Using one playbook only, then it's not possible to have Ansible automagically install the dependent roles. At least according to this SO thread. But, I have the added "advantage" of using Vagrant and Vagrant's Ansible local provisioner. Any tricks I…
Martin Andersson
  • 18,072
  • 9
  • 87
  • 115
9
votes
1 answer

How do I set the SMB username and password?

I have a Vagrantfile (copied below) that uses SMB shared folders. On up, Vagrant always prompts for the username and password. How do I set the username and password once and stop the prompts?! Windows 10 Pro x64 1703 Vagrant 1.9.5 VirtualBox…
V. Korovin
  • 149
  • 1
  • 3
  • 9
9
votes
3 answers

Why is the default Vagrant shared folder empty?

The /vagrant directory is empty. It should contain the workspace where my Vagrantfile is located. I can cd /vagrant, but it's empty. Vagrantfile VAGRANTFILE_API_VERSION = '2' VAGRANT_BOX_NAME =…
sab
  • 4,352
  • 7
  • 36
  • 60
9
votes
0 answers

IntelliJ shows warnings in Vagrantfile when using ruby plugin for syntax highlighting

in order to have nice syntax highlighting for Vagrantfiles I installed the ruby plugin for Intellij IDEA. Unfortunately, now I get a lot of warnings, like "Cannot find Vagrant" "Cannot find configure" "Cannot find vm" Any clue how to get rid of…
Jürgen Gmach
  • 5,366
  • 3
  • 20
  • 37
9
votes
0 answers

Vagrant and Docker provider: Container not loaded, Boot2Docker VM not available with SSH

I'm trying to deploy a simple httpd server with docker and Vagrant to get around the file permission issue with the virtualbox shared folders (I'm using rsync with vagrant, and running Windows as the host) when I run vagrant up, the VM starts (I can…
Ben
  • 966
  • 2
  • 10
  • 24
9
votes
5 answers

Share a single file in vagrant

How do I share a single file, instead of sharing a whole folder like config.vm.synced_folder "host/folder", "box/folder" ? In other words is there a way to have something like: config.vm.synced_folder "host/folder/file.conf",…
Thorben Croisé
  • 12,407
  • 8
  • 39
  • 50
9
votes
2 answers

Getting The box 'hashicorp/precise32' could not be found on firing 'vagrant up' from terminal in ubuntu

I have installed Vagrant and once I am inside my project folder from the terminal I fire the following commands: vagrant box add hashicorp/precise32 http://files.vagrantup.com/precise32.box Output: [vagrant] Downloading with…
Bhavika
  • 540
  • 1
  • 7
  • 16
9
votes
7 answers

Using NFS with vagrant doesn't work

I have the following in my Vagrantfile: config.vm.network :private_network, ip: "10.0.0.103" config.vm.synced_folder ".", "/vagrant/", type: "nfs" doing vagrant up on a fresh box yields: ==> default: Mounting NFS shared folders... The following SSH…
user156888
9
votes
2 answers

Vagrant: Get name of host OS

We have a Vagrant set-up running Ubuntu 12.04 as the guest OS across our team where the host OS is Windows 7 or 8. What I'd like to be able to do is to is to get the hostname of the Windows host machine and append this to the Vagrant hostname during…
Adrian Walls
  • 852
  • 3
  • 19
  • 31
9
votes
4 answers

Is it possible to run a script on a virtual machine after Vagrant finishes provisioning all of them?

I am using Vagrant v1.5.1 to create a cluster of virtual machines (VMs). After all the VMs are provisioned, is it possible to run a single script on one of the machines? The script I want to run will setup passwordless SSH from one VM to all the…
Jane Wayne
  • 8,205
  • 17
  • 75
  • 120
9
votes
2 answers

Vagrant: can't get NFS working

I'm trying to change my VagrantFile so that it uses an NFS mount instead of the default VirtualBox shared folders. I get this error message: vm: * Shared folders that have NFS enabled do not support owner/group attributes. Host path: . This is my…
JamesPlayer
  • 1,834
  • 2
  • 15
  • 21
9
votes
3 answers

Vagrant box: default: Warning: Connection timeout. Retrying

I'm having trouble getting vagrant box running. I tried the solution in this thread: Vagrant stuck connection timeout retrying. No luck there. I also tried increasing the value of config.vm.boot_timeout. No luck either. Please help! $ vagrant…
ironprice91
  • 121
  • 2
  • 4
9
votes
7 answers

Multiple providers in a single vagrant file?

I've got a vagrant file that builds a local VM. I want to add the EC2 provider and have the option of either provisioning a local VM or one on EC2. Can I create configs for multiple providers in the same Vagrantfile and somehow choose which to run…
jbrown
  • 7,518
  • 16
  • 69
  • 117