Вы можете совместно любую папку, которую вы хотите. Вам нужно только указать в файл Vagrantfile, какую папку вы хотите разделить с догадкой
В этом случае я создаю папку с данными , потому что по умолчанию этот один не существует. Это моя структура проекта. Папка данных и Vagrantfile находятся на одном уровне каталогов.
.
├── attributes
├── Berksfile
├── Berksfile.lock
├── chefignore
├── **data**
│ └── **hello**
├── definitions
├── files
│ └── default
├── Gemfile
├── Gemfile.lock
├── libraries
├── LICENSE
├── metadata.rb
├── providers
├── README.md
├── recipes
│ ├── default.rb
│ └── gem_sources.rb
├── resources
├── templates
│ └── default
├── test
│ └── integration
│ └── default
├── Thorfile
└── **Vagrantfile**
Это конфигурация файла Vagrantfile.
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
config.vm.hostname = "ubuntu"
# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "ubuntu-12.04"
# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
config.vm.synced_folder "data", "/vagrant_data"
end
Все в папке с данными доступно в папке vagrant_data в предположении. Вы можете увидеть файл приветствия.
[email protected]:~/Desktop/stack$ vagrant ssh
Welcome to Ubuntu 12.04 LTS (GNU/Linux 3.2.0-23-generic-pae i686)
* Documentation: https://help.ubuntu.com/
Welcome to your Vagrant-built virtual machine.
Last login: Sun Jan 19 13:20:49 2014 from 10.0.2.2
[email protected]:~$ cd /vagrant_data/
[email protected]:/vagrant_data$ ls
hello
[email protected]:/vagrant_data$
Надеюсь, это поможет вам. Извините за мой английский
Как бы это сделать в Vagrantfile? – Contechtions
@Contechtions Я обновил свой ответ. – mariodev