Vagrant提供直播输出 [英] Vagrant provision live output

查看:173
本文介绍了Vagrant提供直播输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法让Vagrant在运行时显示配置工具的输出,而不是结束?我使用的是Ansible插件。

Is there a way to get Vagrant to display the output of the provisioning tool as it runs, rather than just at the end? I'm using the Ansible plugin if that matters.

Vagrant看起来像是运行整个 config.vm.provision

Vagrant appears to run the entire config.vm.provision section collecting the output, only displaying it once everything has completed.

这会导致一些问题,例如当进程中的一个步骤挂起时,或者当您想要执行交互式步骤时用户。

This causes problems such as when a step in the process hangs or when you want to have interactive steps that involve the user.

推荐答案

您可能想要将vagrant日志记录级别更改为调试,以便在执行provision = > VAGRANT_LOG = debug vagrant up --provision

You may want to change vagrant logging level to debug so as to see more output when it does the provision => VAGRANT_LOG=debug vagrant up --provision

这适用于Chef Solo(我没有试过Vagrant Ansible),配置部分的输出类似于具有调试( -l debug )日志级别的运行chef-solo。

This works for Chef Solo (I haven't tried Vagrant with Ansible), the output for the provisioning part is similar to running chef-solo with debug (-l debug) log level.

对于Ansible提供者,自vagrant 1.3.2起添加了以下内容:

For Ansible provisioner, the following been added since vagrant 1.3.2:


  • provisioners / ansible:支持更多详细级别,更好的文档。 [GH-2153]。

  • provisioners/ansible: Support more verbosity levels, better documentation. [GH-2153].

查看请求 2153 ,看起来像官方文档尚未更新。

See pull request 2153 for details, looks like the official doc has NOT been updated yet.

我想你应该能够添加 ansible.verbosity 在Vagrant文​​件中启用最大详细级别

I think you should be able to add ansible.verbosity in the Vagrantfile to enable maximum verbosity level

Vagrant.configure("2") do |config|
  config.vm.provision "ansible" do |ansible|
    ansible.playbook = "provisioning/playbook.yml"
    ansible.verbose = "true"
    ansible.verbosity = "-vvv"
  end
end

这篇关于Vagrant提供直播输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆