当我运行vagrnat provision
期间,当vagrant覆盖主机文件时,我遇到了问题。
在我的主机(我的笔记本电脑)上的src
文件夹中,我有一个带有.git
文件夹的git仓库以及我在仓库中使用的所有实际文件。当我运行vagrant provision
vagrant purges /var/www/site
并且因为文件夹已同步时,请销毁我的主机的site
文件夹副本。我在文件夹同步方面做错了吗?
我使用Windows 7
和Vagrant 1.6.3
Virtualbox 4.3.12
上投放
Vagrant.configure("2") do |config|
#Run a shell provisioner that installs the puppet-mongodb module
config.vm.provision "shell", path: "manifests/install_modules.sh"
# Enable the Puppet provisioner, with will look in manifests
config.vm.provision :puppet do |puppet|
puppet.manifests_path = "manifests"
puppet.manifest_file = "default.pp"
puppet.module_path = "modules"
puppet.options = "--verbose --debug"
end
# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "precise32"
# Forward guest port 80 to host port 8888 and name mapping
config.vm.network :forwarded_port, guest: 80, host: 8001
config.vm.network :forwarded_port, guest: 443, host: 8002
config.vm.synced_folder "site/", "/var/www/site", :owner => "www-data"
end
答案 0 :(得分:0)
糟糕!我意识到我的puppet配置文件中有一行强制清除var/www
。这实际上是我的傀儡配置中的一个错误。
我改变了这一点:
#Create the directory
file {["/var/www","/var/www/virt-env"]:
ensure => directory,
recurse => true,
purge => true,
force => true,
before => [
File["/var/www/virt-env/requirements.txt"],
Class['python']
],
}
对此:
#Create the directory
file{"/var/www":
ensure => directory
before => File["/var/www/virt-env/"]
}
file {"/var/www/virt-env":
ensure => directory,
recurse => true,
purge => true,
force => true,
before => [
File["/var/www/virt-env/requirements.txt"],
Class['python']
],
}