How to continue Vagrant/Ansible provision script from error?

Question:

After I provision my Vagrant… I may get errors during provision… how do I restart from error, instead of doing everything from scratch ?

And I may get an error…

And I want to just resume from where it failed… it seems it can be done by the message… use --limit…. but when I use it in the vagrant context it doesn’t work..

Answer:

You can edit the Vagrantfile and include the ansible.start_at_task variable.

Then you can re-run the provision with $ vagrant reload --provision

Vagrant Reload docs

However, because Ansible plays are idempotent you don’t really need to do the start_at_task. You can just re-run the provision with the reload command above.

Leave a Reply