chef intro @ sf bay area lspe meetup

Post on 30-Jul-2015

4.136 Views

Category:

Technology

1 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Infrastructure Automation���with Chef

Marius Ducea

SF Bay Area #LSPE Sep 23, 2010

whoami

•  System Administrator •  Web Operations Engineer •  Consultant

http://www.flickr.com/photos/dunechaser/161509118/

Chef history

•  March 2008 – first commit •  September 2008 – Opscode founded •  January 2009 – public release •  Today – v0.9.8

Key Chef Principles

•  Idempotent •  Extensible, uses ruby as the configuration language •  Prefers failure over non-deterministic "success" •  Order matters, simplifying dependencies •  Chef Clients do most of the work, not the server.

Chef-Server

Chef-Server Chef-Solo Opscode Platform

Chef-Solo

• run chef without a server • no scalability issues • no search

Chef-Server Chef-Solo Opscode Platform

Opscode Platform

Chef-Server Chef-Solo Opscode Platform

Chef-Client

Chef-Client Ohai

• runs on all your nodes • executes its recipes locally • runs as a daemon or from cron

•  separate project

•  provides metadata from the local system to chef-client

•  this info can be used in recipes or templates

•  produces a JSON data blob

Ohai

Chef-Client Ohai

Nodes

Roles

Cookbooks

Chef components

Node

• any system than runs chef-client • has a run list • recipes and roles are applied in order

Nodes

Roles

Cookbooks

Chef components

Role

Nodes

Roles

Cookbooks

Chef components

Recipe Recipes

Attributes

Templates

Metadata

Nodes

Roles

Cookbooks

Chef components

Attributes Recipes

Attributes

Templates

Metadata

Nodes

Roles

Cookbooks

Chef components

Template Recipes

Attributes

Templates

Metadata

Nodes

Roles

Cookbooks

Chef components

Metadata Recipes

Attributes

Templates

Metadata

Nodes

Roles

Cookbooks

Chef components

Cookbook Recipes

Attributes

Templates

Metadata

Nodes

Roles

Cookbooks

Reuse

Cookbooks Recipes

Attributes

Templates

Metadata

Nodes

Roles

Cookbooks

Share

cookbooks.opscode.com Recipes

Attributes

Templates

Metadata

Nodes

Roles

Cookbooks

Chef components

Recipes

Attributes

Templates

Metadata

Search Search ���

sample nagios & nrpe recipe

Nodes

Roles

Cookbooks

Chef components

nrpe recipe Recipes

Attributes

Templates

Metadata

Search

Nodes

Roles

Cookbooks

Chef components

nagios recipe Recipes

Attributes

Templates

Metadata

Search

Workflow

First you'll need a chef-repo (git clone git://github.com/opscode/chef-repo.git)

cookbooks/ - Cookbooks you download or create. roles/ - Store roles in .rb or .json in the repository.

Use rake tasks to upload to the chef server (rake roles upload_cookbooks)

http://wiki.opscode.com/display/chef/Chef+Repository

knife

command line utility uses the chef-server api. it can create/update/delete roles, cookbooks

has support for various cloud providers like ec2, rackspace:

knife ec2 server list

knife ec2 server create "role[Web]" -i ami-1634de7f -f t1.micro -x ubuntu -I ~/.ssh/id_rsa-my-keypair -S my-keypair

http://wiki.opscode.com/display/chef/Knife

Contributing to chef

Apache license version 2 Very active and helpful community Fill out the CLA

Github used for opscode projects  (chef/cookbooks/ohai) Fork the project, work on topic branches. 

http://wiki.opscode.com/display/chef/Working+with+git

http://wiki.opscode.com/display/chef/How+to+Contribute

Chef is awesome...

•  a library for configuration management •  an api for your entire infrastructure •  powerful search •  sharable cookbooks

Keep in mind... •  chef is still young •  limited os support •  ubuntu love

Questions?

Marius Ducea marius@promethost.com @mariusducea

github.com/mdxp/cookbooks blog: www.ducea.com site: promethost.com

slides: slideshare.net/mdxp

top related