diff options
Diffstat (limited to 'devdocs/vagrant/provisioning%2Fsalt.html')
| -rw-r--r-- | devdocs/vagrant/provisioning%2Fsalt.html | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/devdocs/vagrant/provisioning%2Fsalt.html b/devdocs/vagrant/provisioning%2Fsalt.html new file mode 100644 index 00000000..7d16bad3 --- /dev/null +++ b/devdocs/vagrant/provisioning%2Fsalt.html @@ -0,0 +1,75 @@ +<h1 id="salt-provisioner"> Salt Provisioner </h1> <p><strong>Provisioner name: <code>salt</code></strong></p> <p>The Vagrant Salt provisioner allows you to provision the guest using <a href="http://saltstack.com/">Salt</a> states.</p> <p>Salt states are <a href="https://en.wikipedia.org/wiki/YAML">YAML</a> documents 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.</p> <p><em>NOTE: The Salt provisioner is builtin to Vagrant. If the <code>vagrant-salt</code> plugin is installed, it should be uninstalled to ensure expected behavior.</em></p> <h2 id="masterless-quickstart"> Masterless Quickstart </h2> <p>What follows is a basic Vagrantfile that will get salt working on a single minion, without a master:</p> <div class="highlight"><pre class="highlight ruby" data-language="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| + + salt.masterless = true + salt.minion_config = "salt/minion" + salt.run_highstate = true + + end + end +</pre></div> +<p>This sets up a shared folder for the salt root, and copies the minion file over, then runs <code>state.highstate</code> on the machine. Your minion file must contain the line <code>file_client: local</code> in order to work in a masterless setup.</p> <h2 id="install-options"> Install Options </h2> <ul> <li> +<p><a href="#install_master"><code>install_master</code></a> (boolean) - Should vagrant install the salt-master on this machine. Not supported on Windows guest machines.</p> </li> <li> +<p><a href="#no_minion"><code>no_minion</code></a> (boolean) - Do not install the minion, default <code>false</code>. Not supported on Windows guest machines.</p> </li> <li> +<p><a href="#install_syndic"><code>install_syndic</code></a> (boolean) - Install the salt-syndic, default <code>false</code>. Not supported on Windows guest machines.</p> </li> <li> +<p><a href="#install_type"><code>install_type</code></a> (stable | git | daily | testing) - Whether to install from a distribution's stable package manager, git tree-ish, daily ppa, or testing repository. Not supported on Windows guest machines.</p> </li> <li> +<p><a href="#install_args"><code>install_args</code></a> (string, default: "develop") - When performing a git install, you can specify a branch, tag, or any treeish. Not supported on Windows.</p> </li> <li> +<p><a href="#always_install"><code>always_install</code></a> (boolean) - Installs salt binaries even if they are already detected, default <code>false</code></p> </li> <li> +<p><a href="#bootstrap_script"><code>bootstrap_script</code></a> (string) - Path to your customized salt-bootstrap.sh script. Not supported on Windows guest machines.</p> </li> <li> +<p><a href="#bootstrap_options"><code>bootstrap_options</code></a> (string) - Additional command-line options to pass to the bootstrap script.</p> </li> <li> +<p><a href="#version"><code>version</code></a> (string, default: "2017.7.1") - Version of minion to be installed.</p> </li> <li> +<p><a href="#python_version"><code>python_version</code></a> (string, default: "2") - Major Python version of minion to be installed. Only valid for minion versions >= 2017.7.0. Only supported on Windows guest machines.</p> </li> </ul> <h2 id="minion-options"> Minion Options </h2> <p>These only make sense when <code>no_minion</code> is <code>false</code>.</p> <ul> <li> +<p><a href="#minion_config"><code>minion_config</code></a> (string, default: "salt/minion") - Path to a custom salt minion config file.</p> </li> <li> +<p><a href="#minion_key"><code>minion_key</code></a> (string, default: "salt/key/minion.key") - Path to your minion key</p> </li> <li> +<p><a href="#minion_id"><code>minion_id</code></a> (string) - Unique identifier for minion. Used for masterless and preseeding keys.</p> </li> <li> +<p><a href="#minion_pub"><code>minion_pub</code></a> (string, default: "salt/key/minion.pub") - Path to your minion public key</p> </li> <li> +<p><a href="#grains_config"><code>grains_config</code></a> (string) - Path to a custom salt grains file. On Windows, the minion needs <code>ipc_mode: tcp</code> set otherwise it will <a href="https://github.com/saltstack/salt/issues/22796">fail to communicate</a> with the master.</p> </li> <li> +<p><a href="#masterless"><code>masterless</code></a> (boolean) - Calls state.highstate in local mode. Uses <code>minion_id</code> and <code>pillar_data</code> when provided.</p> </li> <li> +<p><a href="#minion_json_config"><code>minion_json_config</code></a> (string) - Valid json for configuring the salt minion (<code>-j</code> in bootstrap-salt.sh). Not supported on Windows.</p> </li> <li> +<p><a href="#salt_call_args"><code>salt_call_args</code></a> (array) - An array of additional command line flag arguments to be passed to the <code>salt-call</code> command when provisioning with masterless.</p> </li> </ul> <h2 id="master-options"> Master Options </h2> <p>These only make sense when <code>install_master</code> is <code>true</code>. Not supported on Windows guest machines.</p> <ul> <li> +<p><a href="#master_config"><code>master_config</code></a> (string, default: "salt/master") Path to a custom salt master config file.</p> </li> <li> +<p><a href="#master_key"><code>master_key</code></a> (string, default: "salt/key/master.pem") - Path to your master key.</p> </li> <li> +<p><a href="#master_pub"><code>master_pub</code></a> (string, default: "salt/key/master.pub") - Path to your master public key.</p> </li> <li> +<p><a href="#seed_master"><code>seed_master</code></a> (dictionary) - Upload keys to master, thereby pre-seeding it before use. Example: <code>{minion_name:/path/to/key.pub}</code></p> </li> <li> +<p><a href="#master_json_config"><code>master_json_config</code></a> (string) - Valid json for configuring the salt master (<code>-J</code> in bootstrap-salt.sh). Not supported on Windows.</p> </li> <li> +<p><a href="#salt_args"><code>salt_args</code></a> (array) - An array of additional command line flag arguments to be passed to the <code>salt</code> command when provisioning with masterless.</p> </li> </ul> <h2 id="execute-states"> Execute States </h2> <p>Either of the following may be used to actually execute states during provisioning.</p> <ul> <li> +<a href="#run_highstate"><code>run_highstate</code></a> - (boolean) Executes <code>state.highstate</code> on vagrant up. Can be applied to any machine. </li> </ul> <h2 id="execute-runners"> Execute Runners </h2> <p>Either of the following may be used to actually execute runners during provisioning.</p> <ul> <li> +<p><a href="#run_overstate"><code>run_overstate</code></a> - (boolean) Executes <code>state.over</code> on vagrant up. Can be applied to the master only. This is superseded by orchestrate. Not supported on Windows guest machines.</p> </li> <li> +<p><a href="#orchestrations"><code>orchestrations</code></a> - (array of strings) Executes <code>state.orchestrate</code> on vagrant up. Can be applied to the master only. This is superseded by run_overstate. Not supported on Windows guest machines.</p> </li> </ul> <h2 id="output-control"> Output Control </h2> <p>These may be used to control the output of state execution:</p> <ul> <li> +<p><a href="#colorize"><code>colorize</code></a> (boolean) - If true, output is colorized. Defaults to false.</p> </li> <li> +<p><a href="#log_level"><code>log_level</code></a> (string) - The verbosity of the outputs. Defaults to "debug". Can be one of "all", "garbage", "trace", "debug", "info", or "warning". Requires <code>verbose</code> to be set to "true".</p> </li> <li> +<p><a href="#verbose"><code>verbose</code></a> (boolean) - The verbosity of the outputs. Defaults to "false". Must be true for log_level taking effect and the output of the salt-commands being displayed.</p> </li> </ul> <h2 id="pillar-data"> Pillar Data </h2> <p>You can export pillar data for use during provisioning by using the <code>pillar</code> 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::</p> <div class="highlight"><pre class="highlight ruby" data-language="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 +</pre></div> +<p>On Windows guests, this requires PowerShell 3.0 or higher.</p> <h2 id="preseeding-keys"> Preseeding Keys </h2> <p>Preseeding keys is the recommended way to handle provisioning using a master. On a machine with salt installed, run <code>salt-key --gen-keys=[minion_id]</code> to generate the necessary .pub and .pem files</p> <p>For an example of a more advanced setup, look at the original <a href="https://github.com/saltstack/salty-vagrant/tree/develop/example">plugin</a>.</p><div class="_attribution"> + <p class="_attribution-p"> + © 2010–2018 Mitchell Hashimoto<br>Licensed under the MPL 2.0 License.<br> + <a href="https://www.vagrantup.com/docs/provisioning/salt.html" class="_attribution-link">https://www.vagrantup.com/docs/provisioning/salt.html</a> + </p> +</div> |
