我有一个Vagrant文件,在对接口等进行了所有更改之后,最后将我的文件/文件夹从主机同步到来宾计算机。 在来宾计算机和主机上完成/完成同步文件/文件夹后需要触发器。
这些文件/文件夹是我在来宾VM中运行的应用程序级别代码。同步完成后,我想启动我的应用程序代码。
我知道有一个Vagrant触发器,但这是用于Guest虚拟机(VM)生命周期的。 VM启动后,就会触发此触发器,这不是我所需要的。
样本Vagrantfile是
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
# https://docs.vagrantup.com.
# Every Vagrant development environment requires a box. You can search for
# boxes at https://vagrantcloud.com/search.
config.vm.box = "test"
config.vm.hostname = "4ns1i"
config.vm.synced_folder '/opt/abc/xyz/shared/vm_4node_sub_1/Appdata', '/opt/abc/syz/shared/Appdata/', type: 'rsync',rsync__exclude: [".git/","/opt/ciena/CEC/sitemanager*",""], owner: "root", group: "root",rsync__args: ["--verbose", "--archive", "-z", "--copy-links"]
config.vm.provider "libvirt" do |libvirt|
libvirt.cpus = "6"
libvirt.memory = "10240"
libvirt.cpu_mode = "host-passthrough"
libvirt.management_network_mac = "52:54:00:00:01:01"
libvirt.nested = true
libvirt.default_prefix = "vm_4node_sub_1"
libvirt.cputopology :sockets => '1', :cores => '2', :threads => '1'
end
# manual ip
config.vm.define :test do |custom_vm1 |
custom_vm1.vm.network :public_network,
:dev => "VM-Bridge",
:type => "bridge",
:ip => "10.132.251.129",
:auto_config => "false",
:netmask => "255.255.254.0"