From 58916f272df1dc93e1cc2b90a06474d5e61db55c Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sat, 12 Apr 2014 08:51:29 -0700 Subject: [PATCH] website/docs: update docs for winrm shell provisioning --- .../docs/source/v2/provisioning/shell.html.md | 24 +++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/website/docs/source/v2/provisioning/shell.html.md b/website/docs/source/v2/provisioning/shell.html.md index 44c15a782..64140b4d6 100644 --- a/website/docs/source/v2/provisioning/shell.html.md +++ b/website/docs/source/v2/provisioning/shell.html.md @@ -7,14 +7,18 @@ sidebar_current: "provisioning-shell" **Provisioner name: `"shell"`** -The shell provisioner allows you to upload and execute a script as -the root user within the guest machine. +The shell provisioner allows you to upload and execute a script within +the guest machine. Shell provisioning is ideal for users new to Vagrant who want to get up and running quickly and provides a strong alternative for users who aren't comfortable with a full configuration management system such as Chef or Puppet. +For POSIX-like machines, the shell provisioner executes scripts with +SSH. For Windows guest machines that are configured to use WinRM, the +shell provisioner executes PowerShell and Batch scripts over WinRM. + ## Options The shell provisioner takes various options. One of `inline` or `path` @@ -37,10 +41,12 @@ The remainder of the available options are optional: * `binary` (boolean) - Vagrant automatically replaces Windows line endings with Unix line endings. If this is true, then Vagrant will not do this. By default - this is "false". + this is "false". If the shell provisioner is communicating over WinRM, this + defaults to "true". * `privileged` (boolean) - Specifies whether to execute the shell script - as a privileged user or not (`sudo`). By default this is "true". + as a privileged user or not (`sudo`). By default this is "true". This has + no effect for Windows guests. * `upload_path` (string) - Is the remote path where the shell script will be uploaded to. The script is uploaded as the SSH user over SCP, so this @@ -82,7 +88,7 @@ Vagrant.configure("2") do |config| end ``` -I understand if you're not familiar with Ruby, the above may seem very +I understand that if you're not familiar with Ruby, the above may seem very advanced or foreign. But don't fear, what it is doing is quite simple: the script is assigned to a global variable `$script`. This global variable contains a string which is then passed in as the inline script to the @@ -92,6 +98,9 @@ Of course, if any Ruby in your Vagrantfile outside of basic variable assignment makes you uncomfortable, you can use an actual script file, documented in the next section. +For Windows guest machines, the inline script _must_ be PowerShell. Batch +scripts are not allowed as inline scripts. + ## External Script The shell provisioner can also take an option specifying a path to @@ -117,6 +126,11 @@ Vagrant.configure("2") do |config| end ``` +If you're running a Batch of PowerShell script for Windows, make sure +that the external path has the proper extension (".bat" or ".ps1"), because +Windows uses this to determine what kind fo file it is to execute. If you +exclude this extension, it likely won't work. + ## Script Arguments You can parameterize your scripts as well like any normal shell script.