21

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 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.

taskinoor
  • 45,586
  • 12
  • 116
  • 142
Damian Moore
  • 1,306
  • 1
  • 11
  • 13

3 Answers3

16

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

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.

Update added below

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

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

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

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
Terry Wang
  • 13,840
  • 3
  • 50
  • 43
  • Thanks for the tip but this doesn't help. I have now tried a chef_solo provision and can see it shows live output with each step of the provisioning. I think the problem I am having is a limitation of just Vagrant's Ansible provisioner (probably because it's newer and less mature) – Damian Moore Sep 23 '13 at 09:08
  • 5
    verbosity is no longer supported 1.5.0-dev – jdewit Feb 25 '14 at 19:56
3

I found this:

export PYTHONUNBUFFERED=1

here: https://groups.google.com/forum/#!topic/ansible-project/aXutTmXAbR0

and added it here: https://github.com/mitchellh/vagrant/issues/2194

ak5
  • 149
  • 1
  • 2
1

I used Vagrant 1.7.4 and ansible.verbosity is no longer available (since 1.5). It's the right way to do:

Vagrant.configure("2") do |config|
  config.vm.provision "ansible" do |ansible|
    ansible.playbook = "provisioning/playbook.yml"
    ansible.verbose = "vvv"
  end
end
Luc Charpentier
  • 562
  • 5
  • 21