FAQ Database Discussion Community


Vagrant Virtualbox Override Default Network Interface

osx,vagrant,virtualbox,vagrantfile
I would like to override "Adapter 1" and change it from the default NAT to Bridged. This is MacOSX using VirtualBox My feckless attempt is below: NODE_COUNT = 5 NODE_COUNT.times do |i| node_id = "mes00#{i += 1}" config.vm.define node_id do |node| # $network_interface could either be en0 or en1 depending...

Retrying ansible playbook with Vagrant

vagrant,ansible,ansible-playbook,vagrantfile
Is there any way to retry playbooks playbooks from where they failed? I'm starting it with vagrant provision Thanks...

How do I package a vagrantfile so that it is used when 'vagrant init' is called on the box?

vagrant,vagrantfile
I know this is a stupid question, I'm still struggling to grok vagrant. I run vagrant on a windows host, and I'm building Linux guest VMs using VirtualBox. My guest VM is running, and now I want to package it. The Vagrant documentation says "A common misconception is that the...

Vagrant shell provisioning phpPgAdmin password

bash,shell,vagrant,vagrantfile,phppgadmin
How would I get my Vagrant shell script to supply the password when creating a user while provisioning phpPgAdmin? ie. when I supply this command sudo htpasswd -c /etc/phppgadmin/.htpasswd vagrant it prompts for a password for the vagrant user so I can login to phpPgAdmin. How can I script this...

How to package synced folder in vagrant box

node.js,vagrant,web-deployment,vagrantfile
What I want and achieved so far: I want to create a custom vagrant box including a configuration and an application to reuse it in different client or serve environments. Specifically I managed to create vagrant box, based on Ubuntu (precise/64), that has node.js installed, and package it on my...

How to access the list of available boxes in a vagrantfile

vagrant,vagrantfile
I'm trying to make my Vagrantfile smarter by switching between two different boxes depending on what's available. I'd like to be able to create a box from ubuntu/trusty, and configure it with Puppet (already done), but then I'd like to package that box and create further machines using this one...

Vagrant boxes poweroff but still running

vagrant,vagrantfile
I'm problem with my Vagrant boxes. I had a number of boxes in operation, opened my Vagrantfile to add a new box config. Then when I ran vagrant up new_box, I was told that it could not boot and was subsequently placed in poweroff state. Now ALL my boxes are...

How to switch order of network adapters in Vagrant under VirtualBox?

vagrant,virtualbox,vagrantfile
Under Vagrant I have config something like this: Vagrant.configure(2) do |config| config.vm.box = "ubuntu/trusty64" config.vm.provider "virtualbox" do |vb| vb.memory = "512" end config.vm.host_name = 'core.example.com' config.vm.network "forwarded_port", guest: 22, host: 2222, id: 'ssh' config.vm.network "private_network", ip: '172.28.128.3' config.vm.synced_folder "./vagrant_core", "/vagrant", create: true end And after this I receiving something like...

Vagrant box does not see new box_url even after reloading

vagrant,vagrantfile
I updated my Vagrantfile's confg.vm.box_url to a new URL (the box is hosted on a server who's IP changed) and no amount of vagrant reloading will make Vagrant see the new URL. When I run vagrant reload --debug, I see it attempt to fetch metadata from the old URL. The...

Can't ssh to vagrant VMs using the insecure private key (vagrant 1.7.2)

ssh,vagrant,vagrantfile
I have a cluster of 3 VMs. Here is the Vagrantfile: # -*- mode: ruby -*- # vi: set ft=ruby : hosts = { "host0" => "192.168.33.10", "host1" => "192.168.33.11", "host2" => "192.168.33.12" } Vagrant.configure("2") do |config| config.vm.box = "precise64" config.vm.box_url = "http://files.vagrantup.com/precise64.box" config.ssh.private_key_path = File.expand_path('~/.vagrant.d/insecure_private_key') hosts.each do |name, ip|...

Shutdown a vagrant box that is no longer configured

vagrant,virtualbox,vagrantfile
I initially created a Vagrantfile that provisioned a default box. Later, I updated the Vagrantfile to use a named box ("db") with a slightly different config. Unfortunately, I forgot to halt the initial box before I provisioned the new box. Now there's a rogue vagrant box running in the background...

Vagrant port forwarding to PHP server / Permission denied error on php -s

php,vagrant,vagrantfile
I am on OsX Yosemite and had to do the steps here to enable port forwarding. I got this at the end of vagrant up ==> default: Running triggers after up... ==> Fowarding Ports: 80 -> 8080, 443 -> 4443 & Enabling pf The issue now is if I ssh...

How to access Guest's port 3000 from Host?

ruby-on-rails,vagrant,virtualbox,portforwarding,vagrantfile
Here's my Vagrantfile: # -*- mode: ruby -*- # vi: set ft=ruby : Vagrant.configure(2) do |config| config.vm.box = "ubuntu-14.04-x64" # Sync'd folders config.vm.synced_folder ".", "/vagrant", disabled: true config.vm.synced_folder "~/work", "/home/vagrant/work", create: true config.vm.synced_folder "~/apt-archives", "/var/cache/apt/archives/", create: true # Ubuntu VM config.vm.define "ubuntu" do |ubuntu| ubuntu.vm.provision "shell", path: "provision.sh", privileged: false...

Specify --no-parallel flag inside Vagrantfile

vagrant,vagrantfile
According to the documentation http://docs.vagrantup.com/v2/cli/up.html vagrant up has optional parameter --no-parallel Is it possible to specify this flag inside of Vagrantfile or at least warn user if it's not specified?...

Using SaltStack grains file with Vagrant

vagrant,salt,vagrantfile,salt-stack,vagrant-plugin
I would like to use minion.d/*.conf to provision a vagrant machine. Here is my Vagrant configuration: Vagrant.configure("2") do |config| ## Choose your base box config.vm.box = "precise64" ## For masterless, mount your salt file root config.vm.synced_folder "salt/roots/", "/srv/salt/" ## Use all the defaults: config.vm.provision :salt do |salt| salt.minion_config = "salt/minion"...

Multiple folders for homestead not syncing

laravel,vagrant,vagrantfile,homestead
My first homestead project worked without a hitch here's the core part of the homstead.yaml folders: - map: C:\dev\bitbucket to: /home/vagrant/bb sites: - map: project.dev to: /home/vagrant/bb/example/project/public now I wanted to add a different folder into the mix so I extended the yaml to folders: - map: C:\dev\bitbucket to: /home/vagrant/bb...

How to make virtual boxes in Vagrant optional?

ruby,vagrant,vagrantfile
i got a small problem with Vagrant. In the Vagrant file, we defined a list of several virtual boxes that basically use the same configuration and are set up by vagrant: boxes = [ { :name => "box1", :vmnumber => "1", :mem => "256", :cpu => "1" }, { :name...

Download vagrant box file locally from atlas and configuring it

vagrant,vagrantfile
I want to download a vagrant box file from Atlas for using it later locally with my vagrant file. How can I do this, and how can I configure it?

Custom developer setup with Vagrant

vagrant,virtual-machine,virtualbox,vagrantfile
I currently have a Vagrant vm with a typical web setup (apache, php, etc). The actual web repo is checked out onto the my local machine, and accessed through synced folders and forwarded apache ports (like http://127.0.0.1:4567/web). The question is, how do I make this work for a team, as...

Conditionally call different provision in Vagrantfile

vagrant,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" config.vm.provision :shell, :path => "provision/dev-setup.sh" provision/bootstrap.sh needs to be run always, however i need to conditionally run the remaining provisions. For Eg. if dev mode,...

How to install Node.js only if needed (not already installed) on a vagrant shell?

node.js,shell,vagrant,vagrantfile
I'm using vagrant shell provisioning here. I've installed on my vm Node.js along with many other packages. I want to avoid running parts in my provisioning script when I don't need them. For example - I already successfully installed via my script Node.js & nginx, so when I want to...

Chef Vagrant, Can't Find Folder

vagrant,chef,chef-solo,vagrantfile
Chef is really confusing me. Can you help me understand why it's not working? Cliff Notes I'm using Chef-Solo (not Berkshelf or anything else) Everything works when I set it up from scratch, I can vagrant provision But if I reboot the HOST (My main operating system) it breaks! It...