Top Banner
Infrastructure Automation with Chef Marius Ducea SF Bay Area #LSPE Sep 23, 2010
27
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Chef Intro @ SF Bay Area LSPE meetup

Infrastructure Automation���with Chef

Marius Ducea

SF Bay Area #LSPE Sep 23, 2010

Page 2: Chef Intro @ SF Bay Area LSPE meetup

whoami

•  System Administrator •  Web Operations Engineer •  Consultant

Page 3: Chef Intro @ SF Bay Area LSPE meetup

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

Page 4: Chef Intro @ SF Bay Area LSPE meetup

Chef history

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

Page 5: Chef Intro @ SF Bay Area LSPE meetup

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.

Page 6: Chef Intro @ SF Bay Area LSPE meetup

Chef-Server

Chef-Server Chef-Solo Opscode Platform

Page 7: Chef Intro @ SF Bay Area LSPE meetup

Chef-Solo

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

Chef-Server Chef-Solo Opscode Platform

Page 8: Chef Intro @ SF Bay Area LSPE meetup

Opscode Platform

Chef-Server Chef-Solo Opscode Platform

Page 9: Chef Intro @ SF Bay Area LSPE meetup

Chef-Client

Chef-Client Ohai

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

Page 10: Chef Intro @ SF Bay Area LSPE meetup

•  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

Page 11: Chef Intro @ SF Bay Area LSPE meetup

Nodes

Roles

Cookbooks

Chef components

Node

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

Page 12: Chef Intro @ SF Bay Area LSPE meetup

Nodes

Roles

Cookbooks

Chef components

Role

Page 13: Chef Intro @ SF Bay Area LSPE meetup

Nodes

Roles

Cookbooks

Chef components

Recipe Recipes

Attributes

Templates

Metadata

Page 14: Chef Intro @ SF Bay Area LSPE meetup

Nodes

Roles

Cookbooks

Chef components

Attributes Recipes

Attributes

Templates

Metadata

Page 15: Chef Intro @ SF Bay Area LSPE meetup

Nodes

Roles

Cookbooks

Chef components

Template Recipes

Attributes

Templates

Metadata

Page 16: Chef Intro @ SF Bay Area LSPE meetup

Nodes

Roles

Cookbooks

Chef components

Metadata Recipes

Attributes

Templates

Metadata

Page 17: Chef Intro @ SF Bay Area LSPE meetup

Nodes

Roles

Cookbooks

Chef components

Cookbook Recipes

Attributes

Templates

Metadata

Page 18: Chef Intro @ SF Bay Area LSPE meetup

Nodes

Roles

Cookbooks

Reuse

Cookbooks Recipes

Attributes

Templates

Metadata

Page 19: Chef Intro @ SF Bay Area LSPE meetup

Nodes

Roles

Cookbooks

Share

cookbooks.opscode.com Recipes

Attributes

Templates

Metadata

Page 20: Chef Intro @ SF Bay Area LSPE meetup

Nodes

Roles

Cookbooks

Chef components

Recipes

Attributes

Templates

Metadata

Search Search ���

sample nagios & nrpe recipe

Page 21: Chef Intro @ SF Bay Area LSPE meetup

Nodes

Roles

Cookbooks

Chef components

nrpe recipe Recipes

Attributes

Templates

Metadata

Search

Page 22: Chef Intro @ SF Bay Area LSPE meetup

Nodes

Roles

Cookbooks

Chef components

nagios recipe Recipes

Attributes

Templates

Metadata

Search

Page 23: Chef Intro @ SF Bay Area LSPE meetup

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

Page 24: Chef Intro @ SF Bay Area LSPE meetup

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

Page 25: Chef Intro @ SF Bay Area LSPE meetup

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

Page 26: Chef Intro @ SF Bay Area LSPE meetup

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

Page 27: Chef Intro @ SF Bay Area LSPE meetup

Questions?

Marius Ducea [email protected] @mariusducea

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

slides: slideshare.net/mdxp