Search code examples
vagrantpuppetvagrantfile

Vagrant adds 'webroot' folder to my development enviroment


I am just starting to learn how to use vagrant for my development environment, and I've come across an annoyance.

When I vagrant up in the root directory of the project, it add's a webroot folder, this isn't what I'm after.

Vagrant gives me the following structure, with the random webroot folder, I think this is somthing to do with sym_links, but no amount of Googling gives me an answer

| ProjectName ~ Main Project Folder
-| .vagrant ~ Vagrant folder
-| puppet ~ Puppet Configuration Folder
-| vendor ~ Composer vendor folder
-| webroot ~ Randomly added folder :/
- .gitignore
- composer.json
- composer.lock
- Vagrantfile

My Vagrantfile

Vagrant.configure("2") do |config|

  config.vm.define "aws-control" do |namechase|
  end

  # Enable the Puppet provisioner, with will look in manifests
  config.vm.provision :puppet do |puppet|
    puppet.manifests_path = "puppet/manifests"
    puppet.manifest_file = "default.pp"
    puppet.module_path = "puppet/modules"
  end

  # Every Vagrant virtual environment requires a box to build off of.
  config.vm.box = "ubuntu/trusty64"

  # Forward guest port 80 to host port 80 and name mapping
  config.vm.network :forwarded_port, guest: 80, host: 80

  config.vm.network "public_network",
                    ip: "192.168.0.61",
                    bridge: "en0: Ethernet"

  config.vm.hostname = "control.aws"

  # Synced Folders
  config.vm.synced_folder "/", "/vagrant/webroot/", :owner => "www-data"
end

Solution

  • What you're doing when assigning config.vm.synced_folder is you are mounting your entire host filesystem under the /vagrant/webroot directory. Are you sure that's what you are intending to do? Try mounting any other directory and you'll see that the webroot directory does not get created.

    For example this will share the vagrant project directory and it works fine.

    config.vm.synced_folder ".", "/vagrant/webroot/", :owner => "www-data"