Skip to content

Commit 8891713

Browse files
author
kishore cheva
committed
initial chef code
0 parents  commit 8891713

File tree

10 files changed

+226
-0
lines changed

10 files changed

+226
-0
lines changed

.chef/knife.rb

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# See http://docs.chef.io/config_rb_knife.html for more information on knife configuration options
2+
3+
current_dir = File.dirname(__FILE__)
4+
log_level :info
5+
log_location STDOUT
6+
node_name "kishorech816"
7+
client_key "#{current_dir}/kishorech816.pem"
8+
chef_server_url "https://api.chef.io/organizations/devopsindia"
9+
cookbook_path ["#{current_dir}/../cookbooks"]

.gitignore

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Chef
2+
.chef/*.pem
3+
.chef/encrypted_data_bag_secret
4+
5+
# Ruby
6+
.rake_test_cache
7+
.rvmrc
8+
.rbenv-version
9+
10+
# Emacs
11+
*~
12+
\#*\#
13+
/.emacs.desktop
14+
/.emacs.desktop.lock
15+
.elc
16+
auto-save-list
17+
tramp
18+
.\#*
19+
20+
# Emacs org-mode
21+
.org-id-locations
22+
*_archive
23+
24+
# SublimeText
25+
*.sublime-workspace
26+
27+
# TextMate
28+
*.tmproj
29+
*.tmproject
30+
tmtags
31+
32+
# Vim
33+
.*.s[a-w][a-z]
34+
*.un~
35+
Session.vim
36+
.netrwhist
37+
*~
38+
39+
# OS X
40+
.DS_Store
41+
.AppleDouble
42+
.LSOverride
43+
Icon
44+
._*
45+
.Spotlight-V100
46+
.Trashes
47+
48+
# Windows
49+
Thumbs.db
50+
ehthumbs.db
51+
Desktop.ini
52+
$RECYCLE.BIN/

README.md

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
The chef-repo
2+
===============
3+
All installations require a central workspace known as the chef-repo. This is a place where primitive objects--cookbooks, roles, environments, data bags, and chef-repo configuration files--are stored and managed.
4+
5+
The chef-repo should be kept under version control, such as [git](http://git-scm.org), and then managed as if it were source code.
6+
7+
Knife Configuration
8+
-------------------
9+
Knife is the [command line interface](https://docs.chef.io/knife.html) for Chef. The chef-repo contains a .chef directory (which is a hidden directory by default) in which the Knife configuration file (knife.rb) is located. This file contains configuration settings for the chef-repo.
10+
11+
The knife.rb file is automatically created by the starter kit. This file can be customized to support configuration settings used by [cloud provider options](https://docs.chef.io/plugin_knife.html) and custom [knife plugins](https://docs.chef.io/plugin_knife_custom.html).
12+
13+
Also located inside the .chef directory are .pem files, which contain private keys used to authenticate requests made to the Chef server. The USERNAME.pem file contains a private key unique to the user (and should never be shared with anyone). The ORGANIZATION-validator.pem file contains a private key that is global to the entire organization (and is used by all nodes and workstations that send requests to the Chef server).
14+
15+
More information about knife.rb configuration options can be found in [the documentation for knife](https://docs.chef.io/config_rb_knife.html).
16+
17+
Cookbooks
18+
---------
19+
A cookbook is the fundamental unit of configuration and policy distribution. A sample cookbook can be found in `cookbooks/starter`. After making changes to any cookbook, you must upload it to the Chef server using knife:
20+
21+
$ knife upload cookbooks/starter
22+
23+
For more information about cookbooks, see the example files in the `starter` cookbook.
24+
25+
Roles
26+
-----
27+
Roles provide logical grouping of cookbooks and other roles. A sample role can be found at `roles/starter.rb`.
28+
29+
Getting Started
30+
-------------------------
31+
Now that you have the chef-repo ready to go, check out [Learn Chef](https://learn.chef.io/) to proceed with your workstation setup. If you have any questions about Chef you can always ask [our support team](https://www.chef.io/support/) for a helping hand.

cookbooks/chefignore

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Chef
2+
.chef/*.pem
3+
.chef/encrypted_data_bag_secret
4+
5+
# Ruby
6+
.rake_test_cache
7+
.rvmrc
8+
.rbenv-version
9+
10+
# Emacs
11+
*~
12+
\#*\#
13+
/.emacs.desktop
14+
/.emacs.desktop.lock
15+
.elc
16+
auto-save-list
17+
tramp
18+
.\#*
19+
20+
# Emacs org-mode
21+
.org-id-locations
22+
*_archive
23+
24+
# SublimeText
25+
*.sublime-workspace
26+
27+
# TextMate
28+
*.tmproj
29+
*.tmproject
30+
tmtags
31+
32+
# Vim
33+
.*.s[a-w][a-z]
34+
*.un~
35+
Session.vim
36+
.netrwhist
37+
*~
38+
39+
# OS X
40+
.DS_Store
41+
.AppleDouble
42+
.LSOverride
43+
Icon
44+
._*
45+
.Spotlight-V100
46+
.Trashes
47+
48+
# Windows
49+
Thumbs.db
50+
ehthumbs.db
51+
Desktop.ini
52+
$RECYCLE.BIN/
53+
54+
# Git
55+
.git/
56+
.gitignore
57+
.gitmodules
58+
59+
# Subversion
60+
.svn/
61+
62+
# Mercurial
63+
.hg/*
64+
*/.hg/*
65+
.hgignore
+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# This is a Chef attributes file. It can be used to specify default and override
2+
# attributes to be applied to nodes that run this cookbook.
3+
4+
# Set a default name
5+
default["starter_name"] = "Sam Doe"
6+
7+
# For further information, see the Chef documentation (https://docs.chef.io/essentials_cookbook_attribute_files.html).
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
This is a Chef cookbook file. It is used to copy content verbatim on to a server.
2+
For dynamic or otherwise data-driven content, please see sample.erb in the templates/
3+
directory for an example of using a template resource.
4+
5+
You can create a cookbook_file resource in a recipe file:
6+
7+
cookbook_file "/etc/myserver.conf" do
8+
source "sample.txt"
9+
owner "root"
10+
group "root"
11+
mode "644"
12+
end
13+
14+
A cookbook_file resource can be used with any context, including binary files.
15+
16+
For further information, see the Chef documentation (https://docs.chef.io/essentials_cookbook_files.html).

cookbooks/starter/metadata.rb

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
name 'starter'
2+
description 'A basic starter cookbook'
3+
version '1.0.0'
4+
maintainer 'Awesome Company, Inc.'
5+
maintainer_email '[email protected]'

cookbooks/starter/recipes/default.rb

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# This is a Chef recipe file. It can be used to specify resources which will
2+
# apply configuration to a server.
3+
4+
log "Welcome to Chef, #{node["starter_name"]}!" do
5+
level :info
6+
end
7+
8+
# For more information, see the documentation: https://docs.chef.io/essentials_cookbook_recipes.html
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
This is a sample Chef template. It uses the Erubis templating language to insert
2+
dynamic content into text files. For surely static content, including non-text
3+
files, please see sample.txt in the files/ directory for an example of using a
4+
cookbook_file resource.
5+
6+
You can create a template resource in a recipe file:
7+
8+
template "/etc/myserver.conf" do
9+
source "sample.erb"
10+
owner "root"
11+
group "root"
12+
mode "644"
13+
variables :hostname => node["fqdn"], :servers => ["alpha", "bravo", "charlie"]
14+
end
15+
16+
You can insert the value of a template variable by using "<%= %>", such as:
17+
18+
name = <%= @hostname %>
19+
20+
You can also use Ruby loops and conditionals via "<% %>", such as:
21+
22+
<% @servers.each do |name| %>
23+
ServerAlias <%= name %>;
24+
<% end %>
25+
26+
For further information, see the Chef documentation (https://docs.chef.io/essentials_cookbook_templates.html)
27+
and the Erubis User Guide (http://www.kuwata-lab.com/erubis/users-guide.html).

roles/starter.rb

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
name "starter"
2+
description "An example Chef role"
3+
run_list "recipe[starter]"
4+
override_attributes({
5+
"starter_name" => " kishore",
6+
})

0 commit comments

Comments
 (0)