2013-10-03 21:17:41 +00:00
---
2016-01-19 18:08:53 +00:00
layout: "docs"
2013-10-03 21:17:41 +00:00
page_title: "Salt - Provisioning"
sidebar_current: "provisioning-salt"
2016-01-19 18:08:53 +00:00
description: |-
The Vagrant Salt provisioner allows you to provision the guest using
Salt states.
2013-10-03 21:17:41 +00:00
---
# Salt Provisioner
**Provisioner name: `salt` **
2016-01-19 18:08:53 +00:00
The Vagrant Salt provisioner allows you to provision the guest using
2013-10-03 21:17:41 +00:00
[Salt ](http://saltstack.com/ ) states.
2016-01-19 18:08:53 +00:00
Salt states are [YAML ](https://en.wikipedia.org/wiki/YAML ) documents
2013-10-03 21:17:41 +00:00
that describes the current state a machine should be in, e.g. what
packages should be installed, which services are running, and the
contents of arbitrary files.
## Masterless Quickstart
What follows is a basic Vagrantfile that will get salt working
on a single minion, without a master:
```ruby
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|
2015-11-19 02:20:34 +00:00
2015-07-18 14:39:00 +00:00
salt.masterless = true
2013-10-03 21:17:41 +00:00
salt.minion_config = "salt/minion"
salt.run_highstate = true
end
end
```
This sets up a shared folder for the salt root, and copies
the minion file over, then runs `state.highstate` on the
machine. Your minion file must contain the line
2014-05-01 20:49:12 +00:00
`file_client: local` in order to work in a
2013-10-03 21:17:41 +00:00
masterless setup.
## Install Options
2014-05-01 20:49:12 +00:00
* `install_master` (boolean) - Should vagrant install the salt-master
2015-07-18 14:25:40 +00:00
on this machine. Not supported on Windows guest machines.
2013-10-03 21:17:41 +00:00
2016-01-19 18:08:53 +00:00
* `no_minion` (boolean) - Do not install the minion, default `false` . Not supported on Windows guest machines.
2013-10-03 21:17:41 +00:00
2014-05-01 20:49:12 +00:00
* `install_syndic` (boolean) - Install the salt-syndic, default
2015-07-18 14:25:40 +00:00
`false` . Not supported on Windows guest machines.
2013-10-03 21:17:41 +00:00
2015-06-01 15:37:41 +00:00
* `install_type` (stable | git | daily | testing) - Whether to install from a
2014-12-02 21:25:30 +00:00
distribution's stable package manager, git tree-ish, daily ppa, or testing repository.
2013-10-03 21:17:41 +00:00
2016-10-17 16:35:05 +00:00
* `install_args` (string, default: "develop") - When performing a git install, you can specify a branch, tag, or any treeish. Not supported on Windows.
2015-06-01 15:37:41 +00:00
2013-10-03 21:17:41 +00:00
* `always_install` (boolean) - Installs salt binaries even
if they are already detected, default `false`
2015-07-18 14:25:40 +00:00
* `bootstrap_script` (string) - Path to your customized salt-bootstrap.sh script. Not supported on Windows guest machines.
2013-10-03 21:17:41 +00:00
2015-02-24 17:32:55 +00:00
* `bootstrap_options` (string) - Additional command-line options to
pass to the bootstrap script.
2015-07-18 14:25:40 +00:00
* `version` (string, default: "2015.5.2") - Version of minion to be installed. Only supported on Windows guest machines.
2015-07-07 02:36:21 +00:00
2013-10-03 21:17:41 +00:00
## Minion Options
These only make sense when `no_minion` is `false` .
2014-05-01 20:49:12 +00:00
* `minion_config` (string, default: "salt/minion") - Path to
2013-10-03 21:17:41 +00:00
a custom salt minion config file.
2016-10-17 16:35:05 +00:00
* `minion_key` (string, default: "salt/key/minion.key") - Path to your minion key
2013-10-03 21:17:41 +00:00
2015-07-07 02:36:21 +00:00
* `minion_id` (string) - Unique identifier for minion. Used for masterless and preseeding keys.
2016-10-17 16:35:05 +00:00
* `minion_pub` (string, default: "salt/key/minion.pub") - Path to your minion
2013-10-03 21:17:41 +00:00
public key
2015-10-09 05:56:34 +00:00
* `grains_config` (string) - Path to a custom salt grains file. On Windows, the minion needs `ipc_mode: tcp` set otherwise it will [fail to communicate ](https://github.com/saltstack/salt/issues/22796 ) with the master.
2013-10-03 21:17:41 +00:00
2015-07-07 02:36:21 +00:00
* `masterless` (boolean) - Calls state.highstate in local mode. Uses `minion_id` and `pillar_data` when provided.
2013-10-03 21:17:41 +00:00
## Master Options
2015-07-18 14:25:40 +00:00
These only make sense when `install_master` is `true` . Not supported on Windows guest machines.
2013-10-03 21:17:41 +00:00
2015-04-26 19:25:36 +00:00
* `master_config` (string, default: "salt/master")
2015-07-07 02:36:21 +00:00
Path to a custom salt master config file.
2013-10-03 21:17:41 +00:00
2016-10-17 16:35:05 +00:00
* `master_key` (string, default: "salt/key/master.pem") - Path to your master key.
2013-10-03 21:17:41 +00:00
2016-10-17 16:35:05 +00:00
* `master_pub` (string, default: "salt/key/master.pub") - Path to your master public key.
2013-10-03 21:17:41 +00:00
* `seed_master` (dictionary) - Upload keys to master, thereby
pre-seeding it before use. Example: `{minion_name:/path/to/key.pub}`
## Execute States
Either of the following may be used to actually execute states
during provisioning.
2014-05-01 20:49:12 +00:00
* `run_highstate` - (boolean) Executes `state.highstate` on
2013-10-03 21:17:41 +00:00
vagrant up. Can be applied to any machine.
2015-07-07 02:36:21 +00:00
## Execute Runners
Either of the following may be used to actually execute runners
during provisioning.
2014-05-01 20:49:12 +00:00
* `run_overstate` - (boolean) Executes `state.over` on
2016-06-01 02:06:57 +00:00
vagrant up. Can be applied to the master only. This is superseded by
orchestrate. Not supported on Windows guest machines.
2016-06-01 12:31:31 +00:00
* `orchestrations` - (array of strings) Executes `state.orchestrate` on
2016-06-01 02:06:57 +00:00
vagrant up. Can be applied to the master only. This is superseded by
run_overstate. Not supported on Windows guest machines.
2013-10-03 21:17:41 +00:00
2014-05-01 18:07:07 +00:00
## Output Control
These may be used to control the output of state execution:
2014-05-01 20:49:12 +00:00
* `colorize` (boolean) - If true, output is colorized. Defaults to false.
2014-05-01 18:07:07 +00:00
2014-05-01 20:49:12 +00:00
* `log_level` (string) - The verbosity of the outputs. Defaults to "debug".
Can be one of "all", "garbage", "trace", "debug", "info", or
2015-07-07 02:36:21 +00:00
"warning". Requires `verbose` to be set to "true".
2013-10-03 21:17:41 +00:00
## Pillar Data
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::
```ruby
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
```
## Preseeding Keys
2015-07-07 02:36:21 +00:00
Preseeding keys is the recommended way to handle provisioning
2013-10-03 21:17:41 +00:00
using a master.
2014-05-01 20:49:12 +00:00
On a machine with salt installed, run
2013-10-03 21:17:41 +00:00
`salt-key --gen-keys=[minion_id]` to generate the necessary
.pub and .pem files
For a an example of a more advanced setup, look at the original
[plugin ](https://github.com/saltstack/salty-vagrant/tree/develop/example ).