我想使用Vagrant部署应用程序。结构是:
- Vagrant box;
- frontend;
我想在流浪盒外面读取.ts文件。
我的流浪档案:
...
config.vm.provider :virtualbox do |vbox, override|
vbox.cpus = 2
vbox.memory = 4096
override.vm.box = 'box/centos-7.2'
config.vm.synced_folder ".", "/vagrant", disabled: true
override.vm.synced_folder '../frontend/', '/frontend', type: "rsync", rsync__exclude: get_ignored_files()
end
config.vm.provision 'ansible_local' do |ansible|
ansible.playbook = 'ansible/ionic_configuration.yml'
end
...
def get_ignored_files()
ignore_file = ".rsyncignore"
ignore_array = []
if File.exists? ignore_file and File.readable? ignore_file
File.read(ignore_file).each_line do |line|
ignore_array << line.chomp
end
end
return ignore_array
end
我的.rsyncignore:
.DS_Store
.idea
.git
.vscode
ERROR:
运行ansible-playbook .... bash:第2行:cd:/ vagrant:没有这样的文件或目录
我做错了什么?
答案 0 :(得分:0)
运行ansible-playbook .... bash:第2行:cd:/ vagrant:没有这样的文件 或目录
和
config.vm.synced_folder ".", "/vagrant", disabled: true
不相容。
如果您的规定需要访问/vagrant
目录,请不要禁用共享文件夹。只需删除该行
如果您不想保留/vagrant
默认共享文件夹,则需要更改您的配置,以便它不会访问此文件夹并使用其他共享文件夹。