Adoptable Cookbooks List

Supermarket Belongs to the Community

Supermarket belongs to the community. While Chef has the responsibility to keep it running and be stewards of its functionality, what it does and how it works is driven by the community. The chef/supermarket repository will continue to be where development of the Supermarket application takes place. Come be part of shaping the direction of Supermarket by opening issues and pull requests or by joining us on the Chef Mailing List.

Powershell Cookbook

For users of Chef 10 without the powershell_script built-in resource, this cookbook also includes a resource/provider for executing scripts using the PowerShell interpreter.

Requirements

Platforms

Not every version of Windows supports every version of Powershell. The following table illustrates Powershell support across the Windows family. Included means that the base installation of the operating system includes the indicated version of Powershell.

Cookbooks

windows

PowerShell also requires the appropriate version of the Microsoft .NET Framework to be installed, if the operating system does not ship with that version. The following community cookbooks are used to install the correct version of the .NET Framework:

ms_dotnet

Resource/Provider

powershell

Execute a script using the PowerShell interpreter (much like the script resources for bash, csh, perl, python and ruby). A temporary file is created and executed like other script resources, rather than run inline. By their nature, Script resources are not idempotent, as they are completely up to the user's imagination. Use the not_if or only_if meta parameters to guard the resource for idempotence.

Actions

:run: run the script

Attribute Parameters

command: name attribute. Name of the command to execute.

code: quoted string of code to execute.

creates: a file this command creates - if the file exists, the command will not be run.

cwd: current working directory to run the command from.

flags: command line flags to pass to the interpreter when invoking.

environment: A hash of environment variables to set before running this command.

user: A user name or user ID that we should change to before running this command.

group: A group name or group ID that we should change to before running this command.

returns: The return value of the command (may be an array of accepted values). This resource raises an exception if the return value(s) do not match.

timeout: How many seconds to let the command run before timing it out.

# Install without using 'source' attribute
powershell_module "https://github.com/dahlbyk/posh-git/zipball/master" do
package_name "posh-git"
end

Mixin

The Chef::Mixin::PowershellOut mixin has been moved to the windows cookbook.

Usage

Note: The installation may require a restart of the node being configured before PowerShell can be used.

default

The default recipe is needs to be included before using the powershell_module resource.

powershell2

Include the powershell2 recipe in a run list, to ensure PowerShell 2.0 is installed.

On the following versions of Windows the PowerShell 2.0 package will be downloaded from Microsoft and installed:

Windows XP

Windows Server 2003

Windows Server 2008

Windows Vista

On the following versions of Windows, PowerShell 2.0 is present and must just be enabled:

Windows 7

Windows Server 2008 R2

Windows Server 2008 R2 Core

powershell3

Include the powershell3 recipe in a run list, to install PowerShell 3.0 is installed on applicable platforms. If a platform is not supported or if it already includes PowerShell 3.0, an exception will be raised.

powershell4

Include the powershell4 recipe in a run list, to install PowerShell 4.0 is installed on applicable platforms. If a platform is not supported or if it already includes PowerShell 4.0, an exception will be raised.

powershell5

Note: Windows Management Framework 5 is in production preview.

Include the powershell5 recipe in a run list, to install PowerShell 5.0 is installed on applicable platforms. If a platform is not supported or if it already includes PowerShell 5.0, an exception will be raised.

License & Authors

Copyright:: 2011-2015, Chef Software, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.