At OvrClk, we use Vagrant to develop and test our chef cookbooks and it has become an integral part of our workflow.
We also prefer checking in our knife config files in the SCM to reduce friction in setting up chef on our team members’ and clients’ workstations.
As a general rule, anything that is likely to change between development workstations–such as credentials for external services–we extract from the code into environment variables.
We wrote Vagrant ENV plugin to help us do that with ease. It lets you place environment variables in a
.env, which are then made available to the
Vagrantfile via ENV.
Vagrantfile using the plugin could look like this, which is safe to share:
We built this plugin using dotenv, which can be accessed from any ruby file. A
knife.rb config could look like:
This approach also allows us to change configs arbitarily when running individual commands. Please see Github page for usage and other instructions.
Hope you will find the plugin useful. Looking forward to your comments and feedback on Hacker News.