Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Vince committed Aug 24, 2013
0 parents commit acf801e
Show file tree
Hide file tree
Showing 13 changed files with 356 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .berkshelf/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"chef": {
"chef_server_url": "https://api.opscode.com/organizations/locavore-roar",
"validation_client_name": "locavore-roar-validator",
"validation_key_path": ".chef/locavore-roar-validator.pem",
"client_key": ".chef/vkenney.pem",
"node_name": "vkenney"
},
"vagrant": {
"vm": {
"box": "opscode-ubuntu-12.04-i386",
"box_url": "https://opscode-vm.s3.amazonaws.com/vagrant/opscode_ubuntu-12.04-i386_provisionerless.box",
"provision": "chef_client"
}
}
}
13 changes: 13 additions & 0 deletions .chef/knife.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# See http://docs.opscode.com/config_rb_knife.html for more information on knife configuration options

current_dir = File.dirname(__FILE__)
log_level :info
log_location STDOUT
node_name "vkenney"
client_key "#{current_dir}/vkenney.pem"
validation_client_name "locavore-roar-validator"
validation_key "#{current_dir}/locavore-roar-validator.pem"
chef_server_url "https://api.opscode.com/organizations/locavore-roar"
cache_type 'BasicFile'
cache_options( :path => "#{ENV['HOME']}/.chef/checksums" )
cookbook_path ["#{current_dir}/../cookbooks"]
52 changes: 52 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Chef
.chef/*.pem
.chef/encrypted_data_bag_secret

# Ruby
.rake_test_cache
.rvmrc
.rbenv-version

# Emacs
*~
\#*\#
/.emacs.desktop
/.emacs.desktop.lock
.elc
auto-save-list
tramp
.\#*

# Emacs org-mode
.org-id-locations
*_archive

# SublimeText
*.sublime-workspace

# TextMate
*.tmproj
*.tmproject
tmtags

# Vim
.*.s[a-w][a-z]
*.un~
Session.vim
.netrwhist
*~

# OS X
.DS_Store
.AppleDouble
.LSOverride
Icon
._*
.Spotlight-V100
.Trashes

# Windows
Thumbs.db
ehthumbs.db
Desktop.ini
$RECYCLE.BIN/
34 changes: 34 additions & 0 deletions Berksfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# This is a Berkshelf configuration file. It can be used to declare community
# and third-party cookbook dependencies. You can install Berkshelf via the
# command line by typing:
#
# $ gem install berkshelf
#
# For more information on Berkshelf, see the documentation at
# http://berkshelf.com/

# This declares the default location to search for cookbooks. The key :opscode
# tells Berkshelf to search community.opscode.com for cookbooks. For a list of
# other valid keys, see the Berkshelf documentation
site :opscode

# Example usage
# -------------

# Uncomment to download the latest apache2 cookbook from the community site.
# cookbook "apache2"

# Uncomment to download a specific version of the nginx cookbook from
# the community site. The ~> is called a pessimistic version
# constraint. It will pick up any additional patch (bug) releases, but
# will keep the minor version locked at 101. In other words, 0.101.X.
# cookbook "nginx", "~> 0.101.5"

# Berkshelf also allows you to define git locations. Uncomment the following line
# to download the latest master branch from github for this cookbook.
# cookbook "mysql", :git => "https://github.com/opscode-cookbooks/mysql.git"

# Especially for local development, it's helpful to use a local path location.
# Uncomment to point at a local cookbook on the filesystem, relative to the
# current working directory.
# cookbook "myserver", :path => "/code/myserver-cookbook"
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Chef Repository
===============
All Chef installations require a central "workspace" - we call this the **Chef Repository**. This is a place where Chef primitive objects like cookbooks, roles, and data bags, are stored and managed. As such, we highly recommend keeping this repository under version control such as [git](http://git-scm.org), and treat it like source code.

Knife Configuration
-------------------
"Knife" is the CLI (commonad line interface) to Chef. Inside the `.chef` directory of this project (you may need to show hidden files and folders to see it), you will find a `knife.rb`. This file holds configuration and settings for your project.

The `knife.rb` has been automatically created and customized for you. However, you may want to add additional configuration such as [cloud provider options](http://docs.opscode.com/plugin_knife.html) or [knife plugins](http://docs.opscode.com/plugin_knife_custom.html).

Also inside the `.chef` directory you will see two `.pem` files. These are private keys are used to authenticate your requests to the Chef Server. Your `USERNAME.pem` file is private and should never be shared. However your `ORGANIZATION-validator.pem` is global for your Enterprise Chef Organization, and other Chef developers may require it. More information about `knife.rb` configuration options can be found in [the documentation for knife](http://docs.opscode.com/config_rb_knife.html).

Cookbooks
---------
A cookbook is the Chef primitive for telling a machine how to behave. A sample cookbook can be found in `cookbooks/starter`. After making changes to any cookbook, you must upload it to your Chef Server using knife:

$ knife upload cookbooks/starter

For more information about cookbooks, see the example files in the `starter` cookbook.

Roles
-----
Roles provide logical grouping of cookbooks and other roles. A sample role can be found at `roles/starter.rb`.

Getting Started with Chef
-------------------------
Now that you have your Chef Repository ready to go, check out [Learn Chef](https://learnchef.opscode.com/quickstart/workstation-setup/) to proceed with your workstation setup. If you have any questions about Enterprise Chef you can always ask [our support team](https://www.opscode.com/support/tickets/new) for a helping hand.
82 changes: 82 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
# This is a Vagrant configuration file. It can be used to set up and manage
# virtual machines on your local system or in the cloud. See http://downloads.vagrantup.com/
# for downloads and installation instructions, and see http://docs.vagrantup.com/v2/
# for more information and configuring and using Vagrant.

Vagrant.configure("2") do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.

# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "opscode-ubuntu-12.04-i386"

# The url from where the 'config.vm.box' box will be fetched if it
# doesn't already exist on the user's system.
config.vm.box_url = "https://opscode-vm.s3.amazonaws.com/vagrant/opscode_ubuntu-12.04-i386_provisionerless.box"

# This can be set to the host name you wish the guest machine to have. Vagrant
# will automatically execute the configuration necessary to make this happen.
config.vm.hostname = "vkenney-starter"

# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
# config.vm.network :forwarded_port, guest: 80, host: 8080

# Create a private network, which allows host-only access to the machine
# using a specific IP.
# config.vm.network :private_network, ip: "192.168.33.10"

# Create a public network, which generally matched to bridged network.
# Bridged networks make the machine appear as another physical device on
# your network.
# config.vm.network :public_network

# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
# config.vm.synced_folder "../data", "/vagrant_data"

# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
# Example for VirtualBox:
#
# config.vm.provider :virtualbox do |vb|
# # Don't boot with headless mode
# vb.gui = true
#
# # Use VBoxManage to customize the VM. For example to change memory:
# vb.customize ["modifyvm", :id, "--memory", "1024"]
# end
#
# View the documentation for the provider you're using for more
# information on available options.

# Enable provisioning with chef solo, specifying a cookbooks path, roles
# path, and data_bags path (all relative to this Vagrantfile), and adding
# some recipes and/or roles.
#
# config.vm.provision :chef_solo do |chef|
# chef.cookbooks_path = "cookbooks"
# chef.roles_path = "roles"
# chef.data_bags_path = "data_bags"
# chef.add_recipe "mysql"
# chef.add_role "web"
#
# # You may also specify custom JSON attributes:
# chef.json = { :mysql_password => "foo" }
# end

# Enable provisioning with chef server, specifying the chef server URL,
# and the path to the validation key (relative to this Vagrantfile).
#
# config.vm.provision :chef_client do |chef|
# chef.chef_server_url = "https://api.opscode.com/organizations/locavore-roar"
# chef.validation_client_name = "locavore-roar-validator"
# chef.validation_key_path = ".chef/locavore-roar-validator.pem"
# end
end
65 changes: 65 additions & 0 deletions chefignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Chef
.chef/*.pem
.chef/encrypted_data_bag_secret

# Ruby
.rake_test_cache
.rvmrc
.rbenv-version

# Emacs
*~
\#*\#
/.emacs.desktop
/.emacs.desktop.lock
.elc
auto-save-list
tramp
.\#*

# Emacs org-mode
.org-id-locations
*_archive

# SublimeText
*.sublime-workspace

# TextMate
*.tmproj
*.tmproject
tmtags

# Vim
.*.s[a-w][a-z]
*.un~
Session.vim
.netrwhist
*~

# OS X
.DS_Store
.AppleDouble
.LSOverride
Icon
._*
.Spotlight-V100
.Trashes

# Windows
Thumbs.db
ehthumbs.db
Desktop.ini
$RECYCLE.BIN/

# Git
.git/
.gitignore
.gitmodules

# Subversion
.svn/

# Mercurial
.hg/*
*/.hg/*
.hgignore
7 changes: 7 additions & 0 deletions cookbooks/starter/attributes/default.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# This is a Chef attributes file. It can be used to specify default and override
# attributes to be applied to nodes that run this cookbook.

# Set a default name
default["starter_name"] = "Sam Doe"

# For further information, see the Chef documentation (http://docs.opscode.com/essentials_cookbook_attribute_files.html).
16 changes: 16 additions & 0 deletions cookbooks/starter/files/default/sample.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
This is a Chef cookbook file. It is used to copy content verbatim on to a server.
For dynamic or otherwise data-driven content, please see sample.erb in the templates/
directory for an example of using a template resource.

You can create a cookbook_file resource in a recipe file:

cookbook_file "/etc/myserver.conf" do
source "sample.txt"
owner "root"
group "root"
mode "644"
end

A cookbook_file resource can be used with any context, including binary files.

For further information, see the Chef documentation (http://docs.opscode.com/essentials_cookbook_files.html).
3 changes: 3 additions & 0 deletions cookbooks/starter/metadata.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name 'starter'
description 'A basic starter cookbook'
version '1.0.0'
8 changes: 8 additions & 0 deletions cookbooks/starter/recipes/default.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# This is a Chef recipe file. It can be used to specify resources which will
# apply configuration to a server.

log "Welcome to Chef, #{node["starter_name"]}!" do
level :info
end

# For more information, see the documentation: http://docs.opscode.com/essentials_cookbook_recipes.html
27 changes: 27 additions & 0 deletions cookbooks/starter/templates/default/sample.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
This is a sample Chef template. It uses the Erubis templating language to insert
dynamic content into text files. For surely static content, including non-text
files, please see sample.txt in the files/ directory for an example of using a
cookbook_file resource.

You can create a template resource in a recipe file:

template "/etc/myserver.conf" do
source "sample.erb"
owner "root"
group "root"
mode "644"
variables :hostname => node["fqdn"], :servers => ["alpha", "bravo", "charlie"]
end

You can insert the value of a template variable by using "<%= %>", such as:

name = <%= @hostname %>

You can also use Ruby loops and conditionals via "<% %>", such as:

<% @servers.each do |name| %>
ServerAlias <%= name %>;
<% end %>

For further information, see the Chef documentation (http://docs.opscode.com/essentials_cookbook_templates.html)
and the Erubis User Guide (http://www.kuwata-lab.com/erubis/users-guide.html).
6 changes: 6 additions & 0 deletions roles/starter.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name "starter"
description "An example Chef role"
run_list "recipe[starter]"
override_attributes({
"starter_name" => "Vincent Kenney",
})

0 comments on commit acf801e

Please sign in to comment.