Vagrant Synced Folders没有显示

时间:2015-06-03 22:58:37

标签: macos vagrant

我想将包含我的应用程序的OSX dev文件夹同步到我的VM。我的VagrantFile(基于Phansible):

Vagrant.require_version ">= 1.5"
Vagrant.configure("2") do |config|

    config.vm.provider :virtualbox do |v|
        v.name = "default"
        v.customize [
            "modifyvm", :id,
            "--name", "default",
            "--memory", 512,
            "--natdnshostresolver1", "on",
            "--cpus", 1,
        ]
    end

    config.vm.box = "ubuntu/trusty64"        
    config.vm.network :private_network, ip: "192.168.33.99"
    config.ssh.forward_agent = true

    if which('ansible-playbook')
        config.vm.provision "ansible" do |ansible|
            ansible.playbook = "ansible/playbook.yml"
            ansible.inventory_path = "ansible/inventories/dev"
            ansible.limit = 'all'
            ansible.extra_vars = {
                private_interface: "192.168.33.99",
                hostname: "default"
            }
        end
    else
        config.vm.provision :shell, path: "ansible/windows.sh", args: ["default"]
    end

    config.vm.synced_folder "/Users/xylar/Code", "/vagrant", type: "nfs"
end

当我vagrant up时:

==> default: Exporting NFS shared folders...
==> default: Preparing to edit /etc/exports. Administrator privileges will be required...
==> default: Mounting NFS shared folders...
==> default: Running provisioner: ansible...

没有错误消息,当我vagrant ssh并查看vagrant文​​件夹的内容时,我只看到一些点文件(ansible,bash等)。有没有我错过的东西?

2 个答案:

答案 0 :(得分:3)

我很愚蠢。一旦我进入框中,我认为我在同步文件夹中(因为它被称为流浪汉)但是我在/home/vagrant并且已同步的位置在/vagrant

答案 1 :(得分:0)

您需要指定挂载选项:

config.vm.synced_folder "/Users/xylar/Code", "/vagrant", "nfs" => { :mount_options => ['dmode=777', 'fmode=777'] }