嗨,我正在尝试从Vagrantfile将Directory Index指令添加到Apache的默认VirtualHost中。我想知道是否有一种方法可以从Vagrantfile中编辑文件(我使用内联SHELL)。我知道我可以将整个VH文件复制到客户机,但是我想知道如果可能的话如何写入文件。
谢谢!
答案 0 :(得分:0)
您可以像这样用ansible做到这一点:
config.vm.provision "ansible_local" do |ansible|
ansible.verbose = "vv"
ansible.become = true # execute as root
ansible.playbook = "relative_path_to_ansible_file/playbook.yml"
end
或带有外壳
Vagrant.configure("2") do |config|
config.vm.provision "shell" do |s|
s.inline = "echo $1"
s.args = "'hello, world!'"
end
end