I want to use Vagrant to deploy a range of boxes with salt.
I've looked through all the available Vagrant salt options available in salty-vagrant (now built in) and I can't see any that would let me specify which "environment" to use, as referenced in salt.sls
dev:
'webserver*dev*':
- webserver
'db*dev*':
- db
qa:
'webserver*qa*':
- webserver
'db*qa*':
- db
I want to be able to have the same salt directory for all my machine types, and use different Vagrant files (or even parameters to vagrant) to determine whether I'm building a dev box, a qa box, a db box, etc.
Is there any way to pass this information from Vagrant to salt?
Best Answer
The easiest way to pass information to the minion in Vagrant is the minon file. You can define grains in the minion file, but also the ID of the minon.
I set up a set of Vagrant boxes myself using the following approach. Here some excerpts:
In this example the
webserver*
anddb*
entries are the host names. I found that Vagrant sets up the hostname of the box very late (at least when I tried it), so I passed a minon file with the hard coded minon name in vagrant:And the minion file:
You can also define grain information in the minion file.
I hope this helps.
Br, Alexander.