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
8
votes
0 answers

Is it possible to run an ARM64 vagrant instance on the x86_64 host

I'm trying to run an ARM64 Ubuntu VM on an x86_64 host with vagrant for development purposes. I searched the vagrant box on their website only found this one:…
xiaogw
  • 653
  • 8
  • 18
8
votes
3 answers

copy file from host to vagrant virtual machine

I am new with virtual machine. I want to copy a file from host (Mac) to vagrant virtual machine. I could not share a folder, so I want to use command line. How can I copy a file from host to vagrant virtual machine with command line?
Mehdi
  • 1,146
  • 1
  • 14
  • 27
8
votes
2 answers

Vagrant: multiple playbooks for ansible provisioner

Is it possible / valid to run more than one playbooks for a vagrant ansible provisioner in the following form: config.vm.define "repo", primary: true do |d| d.vm.hostname = "some.hostname" # Create a private network, which allows host-only…
pkaramol
  • 16,451
  • 43
  • 149
  • 324
8
votes
3 answers

Set host name for Vagrant VM in Ansible

For testing Ansible, I've set up a Vagrant VM which can be provisioned with vagrant provision, given config.vm.provision "ansible" do |ansible| ansible.playbook = "site.yml" end in the Vagrantfile. This works when I set hosts to all, - hosts:…
Nico Schlömer
  • 53,797
  • 27
  • 201
  • 249
8
votes
1 answer

vagrant - Vagrantfile: sync multiple folders

I have tried the following to sync multiple folders from host to guest machine. But only one folder is getting synced, the later one. config.vm.synced_folder "host/site1", "/var/www/site1" config.vm.synced_folder "host/site2", "/var/www/site2"
8
votes
3 answers

Run code in Vagrantfile only if provisioning

I want to display some text on the screen when running vagrant up (or vagrant provision, etc.) if and only if provisioning is being done. (For vagrant up it is only run the first time, or if specifically forced with --provision.) How can this be…
iconoclast
  • 21,213
  • 15
  • 102
  • 138
7
votes
3 answers

Homestead cant access second site remotely

I have one site setup fine, but the second can't be accessed remotely: My YAML: --- ip: "192.168.10.10" memory: 2048 cpus: 1 provider: virtualbox authorize: ~/.ssh/id_rsa.pub keys: - ~/.ssh/id_rsa folders: - map: ~/Projects to:…
userqwert
  • 2,193
  • 5
  • 28
  • 50
7
votes
2 answers

Vagrant box could not be found error

I am trying to set up virtual machine using virtual box. I have got virtual box and vagrant installed in my windows 7 64-bit machine. I have also built an environment using puphpet. But whenever I try to install the box ubuntu1404-x64 it throws the…
Sid
  • 854
  • 9
  • 23
7
votes
3 answers

vagrant reload synced_folder

Here is my Vagrantfile. config.vm.define :web do |web| web.vm.box = "ubuntu/trusty64" web.vm.network "private_network", ip: "192.168.100.111" web.vm.network "forwarded_port", guest: 22, host: 4444, id: "ssh", auto_correct: true …
7
votes
3 answers

Centos7 with private network lost fixed IP

I've a network issue with a centos7 vagrant box. When I setup a private network, with fixed IP, this one is well binding first, but get lost after some seconds/minutes. vagrant up ==> default: Forcing shutdown of VM... ==> default: Destroying VM…
7
votes
2 answers

Unable to login to vagrant with vagrant up after setting up ssh keys

I have a new user in my vagrant box(trusty64) and I am trying to ssh into it. Instead of logging into vagrant user after vagrant up, I want to login to my username. What I have done so far Created a user in my guest machine. Created ssh key in my…
Shash
  • 4,160
  • 8
  • 43
  • 67
7
votes
2 answers

Vagrant file resync: Vagrant Box does not update new content in text editor

I don't know real detailed specifics about vagrant settings but after I tried to resync my box when it started up. The vagrant box won't update the content I changed from my text editor to the box after the box is booted and before it is stopped and…
applecrusher
  • 5,508
  • 5
  • 39
  • 89
7
votes
3 answers

Multiple ansible versions on same laptop

Can anyone tell how to install two or more ansible versions on one Ubuntu laptop? When I publish my roles in galaxy.ansible.com, I want to set minimal requirement version in meta/main.yml. But now I have ansible 1.9 on my machine, so have…
igormukhingmailcom
  • 465
  • 1
  • 6
  • 9
7
votes
1 answer

How do I set up a Vagrant box to always have a cron job?

How do I configure my Vagrant configuration so that when I provision a machine its crontab is automatically configured? (vagrant is provisioned according to Chef(?) files) As an example, I wanted to have the following cron set up: 5 * * * * curl…
paullb
  • 4,293
  • 6
  • 37
  • 65
7
votes
2 answers

Conditionally call different provision in Vagrantfile

I have the following provisions setup in my Vagrant file. config.vm.provision :shell, :path => "provision/bootstrap.sh" config.vm.provision :shell, :path => "provision/step-1.sh" config.vm.provision :shell, :path => "provision/step-2.sh" …
CodeRain
  • 6,334
  • 4
  • 28
  • 33