Infrastructure Automation with ChefSome call this DevOps. 16 There has been a recent shift, taking...

65
Copyright © 2010 Opscode, Inc - All Rights Reserved Infrastructure Automation with Chef Speaker: Aaron Peterson Technical Evangelist Some Content/Mixin Credit to: John Willis VP Services Adam Jacob CTO 1 1

Transcript of Infrastructure Automation with ChefSome call this DevOps. 16 There has been a recent shift, taking...

Page 1: Infrastructure Automation with ChefSome call this DevOps. 16 There has been a recent shift, taking aspects of software development & agile methodology. Some call this DevOps. k r e

Copyright © 2010 Opscode, Inc - All Rights Reserved

Infrastructure Automation with Chef

Speaker:

Aaron Peterson Technical EvangelistSome Content/Mixin Credit to:John Willis VP ServicesAdam Jacob CTO

11

Page 2: Infrastructure Automation with ChefSome call this DevOps. 16 There has been a recent shift, taking aspects of software development & agile methodology. Some call this DevOps. k r e

Copyright © 2010 Opscode, Inc - All Rights Reserved 22

Page 3: Infrastructure Automation with ChefSome call this DevOps. 16 There has been a recent shift, taking aspects of software development & agile methodology. Some call this DevOps. k r e

Cambrian Explosion

580 Million Years Ago…

Environmental, developmental, and ecological changes accelerated the rate of evolution by

an by an order of magnitude.

3

Page 4: Infrastructure Automation with ChefSome call this DevOps. 16 There has been a recent shift, taking aspects of software development & agile methodology. Some call this DevOps. k r e

Cambrian Explosion

“The rate of evolution of any system is dependent upon the organization of

its subsystems”

Herbert Simon, Theory of Hierarchy and componentization.

4

Page 5: Infrastructure Automation with ChefSome call this DevOps. 16 There has been a recent shift, taking aspects of software development & agile methodology. Some call this DevOps. k r e

Cambrian Explosion

“A Period of Combinatorial Innovation”

Recall component parts that innovators could combine or recombine to create new inventions: In the 1800s, it was interchangeable parts. In 1920, it was electronics. In the 1970s, it was integrated circuits.

Hal Varian a Chief Economist for Google

5

Page 6: Infrastructure Automation with ChefSome call this DevOps. 16 There has been a recent shift, taking aspects of software development & agile methodology. Some call this DevOps. k r e

Cambrian Explosion

Today(John Willis) argues we are at the base of an

explosion of innovation driven primarily by four factors:

• Abstract and fault tolerant components• Unlimited infrastructure• World wide collaboration• Changes in intellectual property

6

Page 7: Infrastructure Automation with ChefSome call this DevOps. 16 There has been a recent shift, taking aspects of software development & agile methodology. Some call this DevOps. k r e

Cambrian Explosion

Abstract and Fault Tolerant Components

• Components are abstract• Bits, software, virtualized• Clustered• Fault tolerant• Parallelized

7

Page 8: Infrastructure Automation with ChefSome call this DevOps. 16 There has been a recent shift, taking aspects of software development & agile methodology. Some call this DevOps. k r e

Cambrian Explosion

Unlimited Infrastructure

• You never run out of them• So there’s no shortage• There are no inventory delays• You can reproduce them• You can duplicate them, you can spread them

around the world

8

Page 9: Infrastructure Automation with ChefSome call this DevOps. 16 There has been a recent shift, taking aspects of software development & agile methodology. Some call this DevOps. k r e

Cambrian Explosion

World Wide Collaboration

• You can have thousands and tens of thousands of innovators combining or recombining the same

component parts to create new innovation.• It’s a situation where the components are available

for everyone.

9

Page 10: Infrastructure Automation with ChefSome call this DevOps. 16 There has been a recent shift, taking aspects of software development & agile methodology. Some call this DevOps. k r e

Cambrian Explosion

Changes in Intellectual Property

• Revolution in how we view intellectual property• Open source• Google – I can be an expert on anything in a matter

of minutes… worst case one day.

10

Page 12: Infrastructure Automation with ChefSome call this DevOps. 16 There has been a recent shift, taking aspects of software development & agile methodology. Some call this DevOps. k r e

Copyright © 2010 Opscode, Inc - All Rights Reserved

Infrastructure is Hard

12

12

Page 13: Infrastructure Automation with ChefSome call this DevOps. 16 There has been a recent shift, taking aspects of software development & agile methodology. Some call this DevOps. k r e

Copyright © 2010 Opscode, Inc - All Rights Reserved

Fully Automated Infrastructure is Hard!

13

13

Page 14: Infrastructure Automation with ChefSome call this DevOps. 16 There has been a recent shift, taking aspects of software development & agile methodology. Some call this DevOps. k r e

Classic infrastructure & operations are major efforts to run.

14

Page 15: Infrastructure Automation with ChefSome call this DevOps. 16 There has been a recent shift, taking aspects of software development & agile methodology. Some call this DevOps. k r e

Copyright © 2010 Opscode, Inc - All Rights Reserved 1515

Page 16: Infrastructure Automation with ChefSome call this DevOps. 16 There has been a recent shift, taking aspects of software development & agile methodology. Some call this DevOps. k r e

There has been a recent shift, taking aspects of software development & agile methodology.

Some call this DevOps.

16

Page 17: Infrastructure Automation with ChefSome call this DevOps. 16 There has been a recent shift, taking aspects of software development & agile methodology. Some call this DevOps. k r e

There has been a recent shift, taking aspects of software development & agile methodology.

Some call this DevOps.

If you think

agile isn’t for

you...

you may be

right!

17

Page 18: Infrastructure Automation with ChefSome call this DevOps. 16 There has been a recent shift, taking aspects of software development & agile methodology. Some call this DevOps. k r e

The rise of exceedingly dynamic businesses and infrastructures to support them created the need for DevOps....

But the sea change in tools, and methodologies that have resulted apply to far more than just those young upstarts startups whippersnappers!

18

Page 19: Infrastructure Automation with ChefSome call this DevOps. 16 There has been a recent shift, taking aspects of software development & agile methodology. Some call this DevOps. k r e

“It is about the collaborative and communicative culture and the tools and process that arise from that culture.”

-John Allspaw (Etsy)

http://www.rationalsurvivability.com/blog/?p=1890

19

Page 20: Infrastructure Automation with ChefSome call this DevOps. 16 There has been a recent shift, taking aspects of software development & agile methodology. Some call this DevOps. k r e

20

Page 22: Infrastructure Automation with ChefSome call this DevOps. 16 There has been a recent shift, taking aspects of software development & agile methodology. Some call this DevOps. k r e

At a High Level...

• A library for configuration management

• A configuration management system

• A systems integration platform

• An API for your entire Infrastructure

http://www.flickr.com/photos/asten/2159525309/sizes/l/

22

Page 23: Infrastructure Automation with ChefSome call this DevOps. 16 There has been a recent shift, taking aspects of software development & agile methodology. Some call this DevOps. k r e

Principles

• Idempotent

• Reasonability

• Sane defaults, easily changed

• Hackability

• TMTOWTDI

http://www.flickr.com/photos/gi/518613153/sizes/o/

23

Page 24: Infrastructure Automation with ChefSome call this DevOps. 16 There has been a recent shift, taking aspects of software development & agile methodology. Some call this DevOps. k r e

The world moves pretty fast

• Primitives

• Enable you to solve your problems

• Your best skill is knowing your systems

http://www.flickr.com/photos/gi/518613153/sizes/o/

24

Page 25: Infrastructure Automation with ChefSome call this DevOps. 16 There has been a recent shift, taking aspects of software development & agile methodology. Some call this DevOps. k r e

So you better be ready

• You need a 3rd generation language

• You’re already a programmer

http://www.flickr.com/photos/gi/518613153/sizes/o/

25

Page 26: Infrastructure Automation with ChefSome call this DevOps. 16 There has been a recent shift, taking aspects of software development & agile methodology. Some call this DevOps. k r e

What is Chef?

Chef is a data-driven systems integration platform

Chef runs infrastructure as a business application

26

Page 27: Infrastructure Automation with ChefSome call this DevOps. 16 There has been a recent shift, taking aspects of software development & agile methodology. Some call this DevOps. k r e

Chef enables Infrastructure as Code

Manage configuration as idempotent Resources.Put them together in Recipes.

Track it like source code.Configure your servers.

27

Page 28: Infrastructure Automation with ChefSome call this DevOps. 16 There has been a recent shift, taking aspects of software development & agile methodology. Some call this DevOps. k r e

Copyright © 2010 Opscode, Inc - All Rights Reserved

Infrastructure as Code

28

http://www.flickr.com/photos/wonderlane/2306082998/

28

Page 29: Infrastructure Automation with ChefSome call this DevOps. 16 There has been a recent shift, taking aspects of software development & agile methodology. Some call this DevOps. k r e

Copyright © 2010 Opscode, Inc - All Rights Reserved

Infrastructure as Code is...

29

A technical domain revolving around building and managing infrastructure programmatically

http://www.flickr.com/photos/kwerfeldein/2634561264/sizes/o/

29

Page 30: Infrastructure Automation with ChefSome call this DevOps. 16 There has been a recent shift, taking aspects of software development & agile methodology. Some call this DevOps. k r e

Copyright © 2010 Opscode, Inc - All Rights Reserved

Enable the reconstruction of the business from nothing

but a source code repository, an application

data backup, and bare metal resources.

3030

Page 31: Infrastructure Automation with ChefSome call this DevOps. 16 There has been a recent shift, taking aspects of software development & agile methodology. Some call this DevOps. k r e

Copyright © 2010 Opscode, Inc - All Rights Reserved

Theory of Constraintsas it applies to IT Infrastructure

31http://www.flickr.com/photos/mabar/313860092/

Dr. Eliyahu M. Goldratt

31

Page 32: Infrastructure Automation with ChefSome call this DevOps. 16 There has been a recent shift, taking aspects of software development & agile methodology. Some call this DevOps. k r e

Copyright © 2010 Opscode, Inc - All Rights Reserved

Your Prime Constraint Should Be

32

The time it takes to

restore your application

data

http://www.flickr.com/photos/visualage/2126833132/sizes/o/

32

Page 33: Infrastructure Automation with ChefSome call this DevOps. 16 There has been a recent shift, taking aspects of software development & agile methodology. Some call this DevOps. k r e

Copyright © 2010 Opscode, Inc - All Rights Reserved 33

(http://radar.oreilly.com/archives/2007/10/operations-advantage.html)

10

20

30

40

50

“Traditional” Operations

# o

f H

our

s

0

5

10

15

20

1 2 3 4 5 6 7 9 10 11 12

Ser

vers

Week #

10

20

30

40

50

Operations - The “Secret Sauce”

UpkeepConfigOS InstallHardware

0

5

10

15

20

1 2 3 4 5 6 7 9 10 11 12

Week #

ExistingNew

This is the secret of Cloud Computing.

Every other virtue stems from here.

Tale of Two Startups

33

Page 34: Infrastructure Automation with ChefSome call this DevOps. 16 There has been a recent shift, taking aspects of software development & agile methodology. Some call this DevOps. k r e

Wax Philosophical

• We are craftsmen and artists

• You need great brushes and tools

• But nobody remembers Gaudi’s hammer

http://www.flickr.com/photos/vgm8383/2686128924/sizes/l/

34

Page 35: Infrastructure Automation with ChefSome call this DevOps. 16 There has been a recent shift, taking aspects of software development & agile methodology. Some call this DevOps. k r e

•Can only be measured by the final solution

http://www.flickr.com/photos/aloshbennett/619307160/sizes/l/

35

Page 36: Infrastructure Automation with ChefSome call this DevOps. 16 There has been a recent shift, taking aspects of software development & agile methodology. Some call this DevOps. k r e

•Hey, that looks a little rough around the edges and pieced-together... BUT IT WORKS

http://www.flickr.com/photos/aloshbennett/619307160/sizes/l/

36

Page 37: Infrastructure Automation with ChefSome call this DevOps. 16 There has been a recent shift, taking aspects of software development & agile methodology. Some call this DevOps. k r e

Copyright © 2010 Opscode, Inc - All Rights Reserved

A Tour of Chef

3737

Page 38: Infrastructure Automation with ChefSome call this DevOps. 16 There has been a recent shift, taking aspects of software development & agile methodology. Some call this DevOps. k r e

Some Principles of Chef’s Design...

You specify the desired result and Chef takes action that will place the system in that state.

38

Page 39: Infrastructure Automation with ChefSome call this DevOps. 16 There has been a recent shift, taking aspects of software development & agile methodology. Some call this DevOps. k r e

Chef prefers failure over non-deterministic "success" when something goes wrong.

39

Page 40: Infrastructure Automation with ChefSome call this DevOps. 16 There has been a recent shift, taking aspects of software development & agile methodology. Some call this DevOps. k r e

Managed clients do most of the work and thus can ask useful questions about their surroundings and the rest of the infrastructure for systems integration.

40

Page 41: Infrastructure Automation with ChefSome call this DevOps. 16 There has been a recent shift, taking aspects of software development & agile methodology. Some call this DevOps. k r e

Chef exposes data and behavior through HTTP to enable integration with external tools.

41

Page 42: Infrastructure Automation with ChefSome call this DevOps. 16 There has been a recent shift, taking aspects of software development & agile methodology. Some call this DevOps. k r e

Apache licensed, Chef's foundation is a growing and vibrant world-class open source community with a culture of quality and reusability.

42

Page 43: Infrastructure Automation with ChefSome call this DevOps. 16 There has been a recent shift, taking aspects of software development & agile methodology. Some call this DevOps. k r e

Copyright © 2010 Opscode, Inc - All Rights Reserved 43

Tomcat6GlassfishApache2 MysqlDynomiteHadoopRiakPostgresql

Chef Cookbook Examples

CouchDBJavaErlangSolrRabbitMQZooKeeperSubversionKickstart

LibvertXenOpenldap OpenVPNAWSRsyncXfsOpenSSL

43

Page 44: Infrastructure Automation with ChefSome call this DevOps. 16 There has been a recent shift, taking aspects of software development & agile methodology. Some call this DevOps. k r e

Copyright © 2010 Opscode, Inc - All Rights Reserved

Chef Client runs on your systems

4444

Page 45: Infrastructure Automation with ChefSome call this DevOps. 16 There has been a recent shift, taking aspects of software development & agile methodology. Some call this DevOps. k r e

Copyright © 2010 Opscode, Inc - All Rights Reserved

They talk to Chef Servers

4545

Page 46: Infrastructure Automation with ChefSome call this DevOps. 16 There has been a recent shift, taking aspects of software development & agile methodology. Some call this DevOps. k r e

Copyright © 2010 Opscode, Inc - All Rights Reserved

They can also stand alone - Chef Solo

4646

Page 47: Infrastructure Automation with ChefSome call this DevOps. 16 There has been a recent shift, taking aspects of software development & agile methodology. Some call this DevOps. k r e

Copyright © 2010 Opscode, Inc - All Rights Reserved

We call each system you configure a Node

4747

Page 48: Infrastructure Automation with ChefSome call this DevOps. 16 There has been a recent shift, taking aspects of software development & agile methodology. Some call this DevOps. k r e

Copyright © 2010 Opscode, Inc - All Rights Reserved

Nodes have a Run List

48

What Roles or Recipes to applyin Order

48

Page 49: Infrastructure Automation with ChefSome call this DevOps. 16 There has been a recent shift, taking aspects of software development & agile methodology. Some call this DevOps. k r e

Copyright © 2010 Opscode, Inc - All Rights Reserved

Nodes have a Run List

4949

Page 50: Infrastructure Automation with ChefSome call this DevOps. 16 There has been a recent shift, taking aspects of software development & agile methodology. Some call this DevOps. k r e

Copyright © 2010 Opscode, Inc - All Rights Reserved

Nodes have Roles

5050

Page 51: Infrastructure Automation with ChefSome call this DevOps. 16 There has been a recent shift, taking aspects of software development & agile methodology. Some call this DevOps. k r e

Copyright © 2010 Opscode, Inc - All Rights Reserved

Chef manages Resources on Nodes

5151

Page 52: Infrastructure Automation with ChefSome call this DevOps. 16 There has been a recent shift, taking aspects of software development & agile methodology. Some call this DevOps. k r e

A Resource...

• Is of a given type.

• Has a name.

• Has attributes.

• Takes actions to bring the resource to a declared state.

Is a declarative description of the state you desire a part of your node to be in.

http://www.flickr.com/photos/xiaming/382205902/sizes/l/

52

Page 53: Infrastructure Automation with ChefSome call this DevOps. 16 There has been a recent shift, taking aspects of software development & agile methodology. Some call this DevOps. k r e

Copyright © 2010 Opscode, Inc - All Rights Reserved 5353

Page 54: Infrastructure Automation with ChefSome call this DevOps. 16 There has been a recent shift, taking aspects of software development & agile methodology. Some call this DevOps. k r e

Copyright © 2010 Opscode, Inc - All Rights Reserved

Resources take action through Providers

5454

Page 55: Infrastructure Automation with ChefSome call this DevOps. 16 There has been a recent shift, taking aspects of software development & agile methodology. Some call this DevOps. k r e

A Provider...

Multiple providers per resource type.

Knows how to actually perform the actions specified by a resource.

Apt, Yum, Rubygems, Portage, Macports, FreeBSD Ports, etc.

http://www.flickr.com/photos/affableslinky/562950216/

Can be overridden with the provider

attribute on a resource.

55

Page 56: Infrastructure Automation with ChefSome call this DevOps. 16 There has been a recent shift, taking aspects of software development & agile methodology. Some call this DevOps. k r e

Resources

http://www.flickr.com/photos/acurbelo/2628837104/sizes/o/

Platform

Provider

56

Page 57: Infrastructure Automation with ChefSome call this DevOps. 16 There has been a recent shift, taking aspects of software development & agile methodology. Some call this DevOps. k r e

Copyright © 2010 Opscode, Inc - All Rights Reserved

Recipes are lists of Resources

5757

Page 58: Infrastructure Automation with ChefSome call this DevOps. 16 There has been a recent shift, taking aspects of software development & agile methodology. Some call this DevOps. k r e

Copyright © 2010 Opscode, Inc - All Rights Reserved

Cookbooks are packages for Recipes

5858

Page 59: Infrastructure Automation with ChefSome call this DevOps. 16 There has been a recent shift, taking aspects of software development & agile methodology. Some call this DevOps. k r e

Copyright © 2010 Opscode, Inc - All Rights Reserved

Cookbooks

Attributes

‣ Node attributes

5959

Page 60: Infrastructure Automation with ChefSome call this DevOps. 16 There has been a recent shift, taking aspects of software development & agile methodology. Some call this DevOps. k r e

Copyright © 2010 Opscode, Inc - All Rights Reserved 60

Cookbooks

Metadatacookbooks/god/metadata.rb

60

Page 61: Infrastructure Automation with ChefSome call this DevOps. 16 There has been a recent shift, taking aspects of software development & agile methodology. Some call this DevOps. k r e

Copyright © 2010 Opscode, Inc - All Rights Reserved

Cookbooks

Other Components

‣ definitions‣ libraries‣ resources‣ providers

6161

Page 62: Infrastructure Automation with ChefSome call this DevOps. 16 There has been a recent shift, taking aspects of software development & agile methodology. Some call this DevOps. k r e

Copyright © 2010 Opscode, Inc - All Rights Reserved 62

Cookbooks are shareable!

cookbooks.opscode.com62

Page 63: Infrastructure Automation with ChefSome call this DevOps. 16 There has been a recent shift, taking aspects of software development & agile methodology. Some call this DevOps. k r e

Copyright © 2010 Opscode, Inc - All Rights Reserved

Add your Cloudy credentials to knife

63

$ vi ~/.chef/knife.rb

63

Page 64: Infrastructure Automation with ChefSome call this DevOps. 16 There has been a recent shift, taking aspects of software development & agile methodology. Some call this DevOps. k r e

Copyright © 2010 Opscode, Inc - All Rights Reserved

Launch a new Rails Server

64

$ knife rackspace server create 'role[rails]'

$ knife ec2 server create ‘role[rails]’

Or just install Chef on your existing servers

64

Page 65: Infrastructure Automation with ChefSome call this DevOps. 16 There has been a recent shift, taking aspects of software development & agile methodology. Some call this DevOps. k r e

Copyright © 2010 Opscode, Inc - All Rights Reserved 65

Questions?

www.opscode.com

‣ Twitter: @opscode, #opschef‣ irc.freenode.net #chef‣ lists.opscode.com

9065