Ger*_*yan 11 virtualbox rhel vagrant vagrant-plugin
我正在使用vagrant在VirtualBox中创建一个Red Hat Enterprise Linux 7 VM.如果我有一个基本框,它既没有VirtualBox客户添加,也没有注册,那么我手动需要执行以下操作:
我需要首先执行注册的原因是要安装guest虚拟机添加,我需要安装一些额外的包.
现在,有这些任务的第三方流浪汉插件:vagrant-registration和vagrant-vbguest.
我遇到的问题是该vagrant-vbguest插件将始终首先尝试运行,并且无法下载所需的软件包,因为该vagrant-registration插件还没有机会注册系统.
有没有办法强迫其中一个在另一个之前运行?或者我还没有想过的任何其他替代解决方案(我不是流浪精灵(或者只是被称为流浪汉?))?
本着我的意见,但它应该是一种更自动的方式
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vbguest.auto_update = false
if Vagrant.has_plugin?("vagrant-registration")
system "vagrant vbguest --auto-reboot --no-provision" if ARGV[0] == 'up'
end
Run Code Online (Sandbox Code Playgroud)
不确定它会以正确的顺序运行(没试过自己)
使用此代码编辑问题的是,它将尝试在命令启动时运行vbguest,因此在vm运行之前,因此vbguest无法安装必要的库.
我看到的另一种可能性是使用vagrant触发器插件(https://github.com/emyl/vagrant-triggers),你可以定义在运行特定命令后运行特定脚本
config.vbguest.auto_update = false
config.trigger.after :up do
run "vagrant vbguest --auto-reboot --no-provision"
end
Run Code Online (Sandbox Code Playgroud)
机器启动后vbguest正确运行(所以我假设在流浪者注册后做了自己的事情)
运行的输出(有趣的部分)vagrant up:
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
default: The guest additions on this VM do not match the installed version of
default: VirtualBox! In most cases this is fine, but in rare cases it can
default: prevent things such as shared folders from working properly. If you see
default: shared folder errors, please make sure the guest additions within the
default: virtual machine match the version of VirtualBox you have installed on
default: your host and reload your VM.
default:
default: Guest Additions Version: 4.2.0
default: VirtualBox Version: 4.3
==> default: Mounting shared folders...
default: /vagrant => /Users/fhenri/project/examples/vagrant/precise
==> default: Running triggers after up...
==> default: Executing command "vagrant vbguest --auto-reboot --no-provision"...
==> default: GuestAdditions versions on your host (4.3.16) and guest (4.2.0) do not match.
Run Code Online (Sandbox Code Playgroud)
客户添加的安装继续,机器重启确定
| 归档时间: |
|
| 查看次数: |
1270 次 |
| 最近记录: |