Provision Vagrant boxes using Saltstack.
Help and discussion can be found at #salt
on Freenode IRC (just ping akoumjian
) or the salt-users mailing list.
DEPRECATED: Vagrant includes a salt provisioner for versions 1.3.0 and above
Salty Vagrant is a plugin for Vagrant which lets you use salt as a provisioning tool. You can use your existing salt formulas and configs to build up development environments.
The simplest way to use Salty Vagrant is by configuring it for masterless mode. With this setup, you use a standalone minion along with your file_roots and/or pillar_roots. See the examples/
folder for more details.
vagrant plugin install vagrant-salt
)vagrant box add precise64 http://files.vagrantup.com/precise64.box
Vagrantfile
(Detailed in Configuration) [2]salt/minion
[1]vagrant up
and you should be good to go.file_client: local
for masterless
Here is an extremely simple Vagrantfile
, to be used with the above masterless setup:
Vagrant.configure("2") do |config| ## Choose your base box config.vm.box = "precise64" ## For masterless, mount your salt file root config.vm.synced_folder "salt/roots/", "/srv/salt/" ## Use all the defaults: config.vm.provision :salt do |salt| salt.minion_config = "salt/minion" salt.run_highstate = true end end
state.highstate
on vagrant up
pillar
command referenced below)
git clone https://github.com/saltstack/salty-vagrant.git
cd salty-vagrant
git submodule init
git submodule update
gem install rubygems-bundler
gem build vagrant-salt.gemspec
vagrant plugin install vagrant-salt-[version].gem
If you'd like to include the latest stable revision of the salt-bootstrap script, run the following after step 5:
cd scripts
git pull origin stable
You can export pillar data for use during provisioning by using the pillar
command. Each call will merge the data so you can safely call it multiple times. The data passed in should only be hashes and lists. Here is an example:
config.vm.provision :salt do |salt| # Export hostnames for webserver config salt.pillar({ "hostnames" => { "www" => "www.example.com", "intranet" => "intranet.example.com" } }) # Export database credentials salt.pillar({ "database" => { "user" => "jdoe", "password" => "topsecret" } }) salt.run_highstate = true end
If you are already using Salt for deployment, you can use your existing master to provision your vagrant boxes as well. You will need to do one of the following:
On the master, create the keypair and add the public key to the accepted minions folder:
root@saltmaster# salt-key --gen-keys=[minion_id] root@saltmaster# cp [minion_id].pub /etc/salt/pki/master/minions/[minion_id]
Replace [minion_id]
with the id you would like to assign the minion.
Next you want to bundle the key pair along with your Vagrantfile, the salt_provisioner.rb, and your minion config. The directory should look something like this:
myvagrant/ Vagrantfile salt/ minion.conf key/ minion.pem minion.pub
You will need to determine your own secure method of transferring this package. Leaking the minion's private key poses a security risk to your salt network.
The are two required settings for your minion.conf
file:
master: [master_fqdn] id: [minion_id]
Make sure you use the same [minion_id]
that you used on the master or it will not match with the key.
Create/Update your Vagrantfile
per the example provided in the Configuration section.
Finally, you should be able to run vagrant up
and the salt should put your vagrant minion in state.highstate.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4