oferrigni / pantry-chef-repo

A Chef Repository For Pantry

Home Page:https://supermarket.chef.io/cookbooks/pantry

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Chef Pantry

Welcome to the Pantry!

Pantry is a workstation automation cookbook and Chef repository. The cookbook itself is shared on the Supermarket community site, and has its own git repository.

TL;DR:

git clone https://github.com/chef/pantry-chef-repo
cd pantry-chef-repo
sudo ./bin/pantry -c

Getting Started

Get this repository on your system. You can clone it if you have git installed, or you can download the zip archive.

Once you have the pantry-chef-repo on your system, open a terminal, and run the pantry script with sudo.

To just perform the installation:

sudo ./bin/pantry

To perform the installation and run Chef with the default Policyfile.rb, use the -c option.

sudo ./bin/pantry -c

Installing Packages

Packages are installed by populating attribute arrays with a list of names to install. For OS X, these are handled by the homebrew cookbook's formulas and casks attributes. For Windows, these are handled by Chocolatey.

Update the Policyfile.rb attributes to modify the package lists you want to install.

default['homebrew']['formulas'] = %w(coreutils go postgresql)
default['homebrew']['casks'] = %w(google-chrome skype vagrant)

./bin/pantry will use the Policyfile.rb to add these attributes to the node. Then update the Policyfile.lock.json and export the repository.

chef update
chef export --force zero-repo
sudo chef-client -z

Using a Chef Server

This is optional.

Pantry can be used with a Chef Server. Since this isn't the default, it does require a little more work on your part. For this example, I'll use Hosted Chef as my server.

Note Don't use -c with the bin/pantry script. It assumes running chef-client with local mode.

Before running chef-client, do the following:

Create /etc/chef/client.rb with at least the following content, and copy your organization's validation client key (ORGNAME-validator.pem) to /etc/chef/validation.pem.

chef_server_url 'https://api.opscode.com/organizations/ORGNAME'
validation_client_name 'ORGNAME-validator'

Create .chef/knife.rb or ~/.chef/knife.rb with the following content. Replace ORGNAME and HOSTED_USERNAME with your values.

chef_server_url 'https://api.opscode.com/organizations/ORGNAME'
node_name 'HOSTED_USERNAME'
client_key 'path/to/your/HOSTED_USERNAME.pem'
use_policyfile true
deployment_group 'pantry-chef-server'
versioned_cookbooks true

Obtain the validation client key from your Chef Server. For example, I downloaded mine from the Hosted Chef starter kit. Copy it to /etc/chef.

Upload the cookbooks from this repository.

chef install
chef push

Run Chef!

sudo chef-client

bin/pantry

The pantry script takes 0 or 1 argument. It does the following:

  1. Install ChefDK using CHEF's installation script that downloads the package with the Omnitruck API.
  2. "Vendors" the required cookbooks into zero-repo using Chef Policyfiles.
  3. Optionally runs chef-client (using "local mode") with the base role in this repository if the -c argument is used.

For more information about Policyfiles, see its README.

Scope

Workstations are personalized work environments. Pantry is opinionated where it needs to be and tries to stay out of the way of the user. It is not in the scope to support every possible use case on all workstation operating systems. The primary purpose is to get the base OS environment setup to be able to install packages and software commonly desired for workstation systems, and provide a framework to build upon with other cookbooks.

Requirements

ChefDK: As this is intended to run on a workstation that is presumably also used for Chef development, the default and supported method of installing Chef is using the ChefDK. This is performed by the bin/pantry script.

Administrative/privileged access: Some of the things required to setup a workstation involve root/administrative privileges. As such, chef-client should be invoked using sudo, or otherwise in an administrative shell. Note that this can have interesting interactions with software such as Homebrew, and we've tried to accommodate that. If you encounter any problems, please open an issue.

Platform:

  • OS X 10.9, 10.10
  • Windows 8.1

It may work on other versions of these platforms with or without modification.

Future (planned): Linux (Debian and RHEL families). See Bugs, below.

Bugs

Report issues in this repository. We may close your issue and open it elsewhere if appropriate. For example, supporting other platforms is deferred to the pantry cookbook

Homebrew cask prior to version 0.50.0 has an issue fixed in 0.50.0+ that requires upgrading brew-cask. TL;DR:

brew update && brew upgrade brew-cask && brew cleanup

License and Author

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.

About

A Chef Repository For Pantry

https://supermarket.chef.io/cookbooks/pantry

License:Apache License 2.0


Languages

Language:Shell 45.9%Language:PowerShell 35.7%Language:Ruby 18.4%