As you are starting to standardize on using test-kitchen the problem of passwords and security start to appear. Yeah, using kitchen locally with vagrant is great, but as you start using remote instances you need a way to pass passwords to track things. Here’s a quick example and use case.
There are a couple ways to skin this cat, but I’ll take the ones that I like to suggest.
First set up your
kitchen.yml so it can take variables, for instance:
driver: name: vsphere driver_options: host: vcenter.tirefi.re user: <%= ENV['VCENTER_USER'] || "firstname.lastname@example.org" %> password: <%= ENV['VCENTER_PASSWORD'] || "P@ssw0rd!" %>
Awesome, this sets the default username to
the default password to
P@ssw0rd!. Obviously, you shouldn’t use
hopefully you get the point. Now if you need to over ride it with your user name and
ENV variables will do the trick! Here’s an example:
~$ VCENTER_USER="email@example.com" VCENTER_PASSWORD="N0tmyP@ssw0rd" kitchen verify
Pretty neat eh? But man, that’s gonna be pretty annoying to type out each time, so how I get around
it is setting up file to source each time I open a new shell and add this line to my
export VCENTER_USER="firstname.lastname@example.org" export VCENTER_PASSWORD="N0tmyP@ssw0rd"