Wednesday, October 22, 2014

Vagrant/Ansible trick: autoreload

When testing Ansible scripts, it's nice to have your Vagrant VM automatically re-provision itself when you change the configuration.  In this way just saving a file lets you see the VM reinstall packages and so forth, with errors appearing immediately.

The following runs a tiny reprovisioning script each time your Ansible YAML files change:

pip install watchmedo

watchmedo shell-command --drop --pattern='*.yml' --command='clear; vagrant provision'

No comments:

Post a Comment