Automatisierungstechnologien fuer-die-infrastruktur-mit-chef

41
About Wozu Automatisierung? Chef Examples Search Automatisierungstechnologien f¨ ur die Infrastruktur mit Chef Frederic Jaeckel (SoundCloud) 5. April 2011 Frederic Jaeckel (SoundCloud) Automatisierungstechnologien f¨ ur die Infrastruktur mit Chef

Transcript of Automatisierungstechnologien fuer-die-infrastruktur-mit-chef

AboutWozu Automatisierung?

ChefExamples

Search

Automatisierungstechnologien fur die Infrastrukturmit Chef

Frederic Jaeckel (SoundCloud)

5. April 2011

Frederic Jaeckel (SoundCloud) Automatisierungstechnologien fur die Infrastruktur mit Chef

AboutWozu Automatisierung?

ChefExamples

Search

Inhaltsverzeichnis

1 About

2 Wozu Automatisierung?

3 ChefArchitekturObjekteUtilities

4 ExamplesCookbooksCookbooksNode AttributesRolesData Bags

5 SearchSearch

Frederic Jaeckel (SoundCloud) Automatisierungstechnologien fur die Infrastruktur mit Chef

AboutWozu Automatisierung?

ChefExamples

Search

About me

(Dev)Op bei SoundCloud

Zuvor im Security und Enterprise Umfeld tatig gewesen

UNIX user/admin seit vielen Jahren

Twitter: twitter.com/jaycieh

SoundCloud: soundcloud.com/jaycieh

Frederic Jaeckel (SoundCloud) Automatisierungstechnologien fur die Infrastruktur mit Chef

AboutWozu Automatisierung?

ChefExamples

Search

About me

(Dev)Op bei SoundCloud

Zuvor im Security und Enterprise Umfeld tatig gewesen

UNIX user/admin seit vielen Jahren

Twitter: twitter.com/jaycieh

SoundCloud: soundcloud.com/jaycieh

Frederic Jaeckel (SoundCloud) Automatisierungstechnologien fur die Infrastruktur mit Chef

AboutWozu Automatisierung?

ChefExamples

Search

About me

(Dev)Op bei SoundCloud

Zuvor im Security und Enterprise Umfeld tatig gewesen

UNIX user/admin seit vielen Jahren

Twitter: twitter.com/jaycieh

SoundCloud: soundcloud.com/jaycieh

Frederic Jaeckel (SoundCloud) Automatisierungstechnologien fur die Infrastruktur mit Chef

AboutWozu Automatisierung?

ChefExamples

Search

About me

(Dev)Op bei SoundCloud

Zuvor im Security und Enterprise Umfeld tatig gewesen

UNIX user/admin seit vielen Jahren

Twitter: twitter.com/jaycieh

SoundCloud: soundcloud.com/jaycieh

Frederic Jaeckel (SoundCloud) Automatisierungstechnologien fur die Infrastruktur mit Chef

AboutWozu Automatisierung?

ChefExamples

Search

About SoundCloud

Sharing Music

Etwa 3 Millionen User

50.000 Twitter und Facebook shares taeglich

Hauptsitz in Berlin

Frederic Jaeckel (SoundCloud) Automatisierungstechnologien fur die Infrastruktur mit Chef

AboutWozu Automatisierung?

ChefExamples

Search

About SoundCloud

Sharing Music

Etwa 3 Millionen User

50.000 Twitter und Facebook shares taeglich

Hauptsitz in Berlin

Frederic Jaeckel (SoundCloud) Automatisierungstechnologien fur die Infrastruktur mit Chef

AboutWozu Automatisierung?

ChefExamples

Search

About SoundCloud

Sharing Music

Etwa 3 Millionen User

50.000 Twitter und Facebook shares taeglich

Hauptsitz in Berlin

Frederic Jaeckel (SoundCloud) Automatisierungstechnologien fur die Infrastruktur mit Chef

AboutWozu Automatisierung?

ChefExamples

Search

About SoundCloud

Sharing Music

Etwa 3 Millionen User

50.000 Twitter und Facebook shares taeglich

Hauptsitz in Berlin

Frederic Jaeckel (SoundCloud) Automatisierungstechnologien fur die Infrastruktur mit Chef

AboutWozu Automatisierung?

ChefExamples

Search

Wozu Automatisierung?

Konsistenz

/etc/hosts, User Erstellung, Anpassen von config Variablen

rapid development

Hosts werden ferngesteuert

Der SysOp wird zum DevOp

Schnelleres Scaling

Weniger Manpower

Weniger Fehler

Frederic Jaeckel (SoundCloud) Automatisierungstechnologien fur die Infrastruktur mit Chef

AboutWozu Automatisierung?

ChefExamples

Search

Wozu Automatisierung?

Konsistenz

/etc/hosts, User Erstellung, Anpassen von config Variablen

rapid development

Hosts werden ferngesteuert

Der SysOp wird zum DevOp

Schnelleres Scaling

Weniger Manpower

Weniger Fehler

Frederic Jaeckel (SoundCloud) Automatisierungstechnologien fur die Infrastruktur mit Chef

AboutWozu Automatisierung?

ChefExamples

Search

Wozu Automatisierung?

Konsistenz

/etc/hosts, User Erstellung, Anpassen von config Variablen

rapid development

Hosts werden ferngesteuert

Der SysOp wird zum DevOp

Schnelleres Scaling

Weniger Manpower

Weniger Fehler

Frederic Jaeckel (SoundCloud) Automatisierungstechnologien fur die Infrastruktur mit Chef

AboutWozu Automatisierung?

ChefExamples

Search

Wozu Automatisierung?

Konsistenz

/etc/hosts, User Erstellung, Anpassen von config Variablen

rapid development

Hosts werden ferngesteuert

Der SysOp wird zum DevOp

Schnelleres Scaling

Weniger Manpower

Weniger Fehler

Frederic Jaeckel (SoundCloud) Automatisierungstechnologien fur die Infrastruktur mit Chef

AboutWozu Automatisierung?

ChefExamples

Search

Wozu Automatisierung?

Konsistenz

/etc/hosts, User Erstellung, Anpassen von config Variablen

rapid development

Hosts werden ferngesteuert

Der SysOp wird zum DevOp

Schnelleres Scaling

Weniger Manpower

Weniger Fehler

Frederic Jaeckel (SoundCloud) Automatisierungstechnologien fur die Infrastruktur mit Chef

AboutWozu Automatisierung?

ChefExamples

Search

Wozu Automatisierung?

Konsistenz

/etc/hosts, User Erstellung, Anpassen von config Variablen

rapid development

Hosts werden ferngesteuert

Der SysOp wird zum DevOp

Schnelleres Scaling

Weniger Manpower

Weniger Fehler

Frederic Jaeckel (SoundCloud) Automatisierungstechnologien fur die Infrastruktur mit Chef

AboutWozu Automatisierung?

ChefExamples

Search

ArchitekturObjekteUtilities

Chef Komponenten

Ruby Merb Webserver (API + Web)

RabbitMQ

Solr Search

CouchDB

Frederic Jaeckel (SoundCloud) Automatisierungstechnologien fur die Infrastruktur mit Chef

AboutWozu Automatisierung?

ChefExamples

Search

ArchitekturObjekteUtilities

Chef Komponenten

Ruby Merb Webserver (API + Web)

RabbitMQ

Solr Search

CouchDB

Frederic Jaeckel (SoundCloud) Automatisierungstechnologien fur die Infrastruktur mit Chef

AboutWozu Automatisierung?

ChefExamples

Search

ArchitekturObjekteUtilities

Chef Komponenten

Ruby Merb Webserver (API + Web)

RabbitMQ

Solr Search

CouchDB

Frederic Jaeckel (SoundCloud) Automatisierungstechnologien fur die Infrastruktur mit Chef

AboutWozu Automatisierung?

ChefExamples

Search

ArchitekturObjekteUtilities

Chef Komponenten

Ruby Merb Webserver (API + Web)

RabbitMQ

Solr Search

CouchDB

Frederic Jaeckel (SoundCloud) Automatisierungstechnologien fur die Infrastruktur mit Chef

AboutWozu Automatisierung?

ChefExamples

Search

ArchitekturObjekteUtilities

Nodes, Clients, Data Bags und Utilities

Nodes - sind Objekte, in dem Fall der Infrastruktur: Server

Clients - definieren den Zugang zu Nodes, Attributen undData Bags

Data Bags - beinhalten Daten die universellwiederverwendbar sind

Utilities - stellen den Zugang zu der ManagementInfrastruktur her

Frederic Jaeckel (SoundCloud) Automatisierungstechnologien fur die Infrastruktur mit Chef

AboutWozu Automatisierung?

ChefExamples

Search

ArchitekturObjekteUtilities

Nodes, Clients, Data Bags und Utilities

Nodes - sind Objekte, in dem Fall der Infrastruktur: Server

Clients - definieren den Zugang zu Nodes, Attributen undData Bags

Data Bags - beinhalten Daten die universellwiederverwendbar sind

Utilities - stellen den Zugang zu der ManagementInfrastruktur her

Frederic Jaeckel (SoundCloud) Automatisierungstechnologien fur die Infrastruktur mit Chef

AboutWozu Automatisierung?

ChefExamples

Search

ArchitekturObjekteUtilities

Nodes, Clients, Data Bags und Utilities

Nodes - sind Objekte, in dem Fall der Infrastruktur: Server

Clients - definieren den Zugang zu Nodes, Attributen undData Bags

Data Bags - beinhalten Daten die universellwiederverwendbar sind

Utilities - stellen den Zugang zu der ManagementInfrastruktur her

Frederic Jaeckel (SoundCloud) Automatisierungstechnologien fur die Infrastruktur mit Chef

AboutWozu Automatisierung?

ChefExamples

Search

ArchitekturObjekteUtilities

Nodes, Clients, Data Bags und Utilities

Nodes - sind Objekte, in dem Fall der Infrastruktur: Server

Clients - definieren den Zugang zu Nodes, Attributen undData Bags

Data Bags - beinhalten Daten die universellwiederverwendbar sind

Utilities - stellen den Zugang zu der ManagementInfrastruktur her

Frederic Jaeckel (SoundCloud) Automatisierungstechnologien fur die Infrastruktur mit Chef

AboutWozu Automatisierung?

ChefExamples

Search

ArchitekturObjekteUtilities

Utilities

Knife - CLI Programm zum Steuern von Chef

Web Frontend - Ein Web frontend zum benutzen von Chef

Zugang fuer Kunden, eingeschraenkter Zugriff zum Lesen

Shef - IRB console fuer Chef zum interaktivenMasseneditieren

Frederic Jaeckel (SoundCloud) Automatisierungstechnologien fur die Infrastruktur mit Chef

AboutWozu Automatisierung?

ChefExamples

Search

ArchitekturObjekteUtilities

Utilities

Knife - CLI Programm zum Steuern von Chef

Web Frontend - Ein Web frontend zum benutzen von Chef

Zugang fuer Kunden, eingeschraenkter Zugriff zum Lesen

Shef - IRB console fuer Chef zum interaktivenMasseneditieren

Frederic Jaeckel (SoundCloud) Automatisierungstechnologien fur die Infrastruktur mit Chef

AboutWozu Automatisierung?

ChefExamples

Search

ArchitekturObjekteUtilities

Utilities

Knife - CLI Programm zum Steuern von Chef

Web Frontend - Ein Web frontend zum benutzen von Chef

Zugang fuer Kunden, eingeschraenkter Zugriff zum Lesen

Shef - IRB console fuer Chef zum interaktivenMasseneditieren

Frederic Jaeckel (SoundCloud) Automatisierungstechnologien fur die Infrastruktur mit Chef

AboutWozu Automatisierung?

ChefExamples

Search

CookbooksCookbooksNode AttributesRolesData Bags

Cookbooks

ls -lR sudo/

P r o j e c t s / system/ cookbooks / sudo :t o t a l 24drwxr−xr−x 2 f r e d e r i c f r e d e r i c 4096 Nov 30 11 :45 a t t r i b u t e s−rw−r−−r−− 1 f r e d e r i c f r e d e r i c 1801 Mar 9 08 :56 metadata . j s o n−rw−r−−r−− 1 f r e d e r i c f r e d e r i c 961 Dec 7 11 :28 metadata . rb−rw−r−−r−− 1 f r e d e r i c f r e d e r i c 1801 Nov 30 11 :45 README.mddrwxr−xr−x 2 f r e d e r i c f r e d e r i c 4096 Nov 30 11 :45 r e c i p e sdrwxr−xr−x 3 f r e d e r i c f r e d e r i c 4096 Nov 30 11 :45 t emp l a t e s

P r o j e c t s / system/ cookbooks / sudo/ a t t r i b u t e s :t o t a l 4−rw−r−−r−− 1 f r e d e r i c f r e d e r i c 744 Nov 30 11 :45 d e f a u l t . rb

P r o j e c t s / system/ cookbooks / sudo/ r e c i p e s :t o t a l 4−rw−r−−r−− 1 f r e d e r i c f r e d e r i c 906 Nov 30 11 :45 d e f a u l t . rb

P r o j e c t s / system/ cookbooks / sudo/ t emp l a t e s :t o t a l 4drwxr−xr−x 2 f r e d e r i c f r e d e r i c 4096 Feb 9 14 :15 d e f a u l t

P r o j e c t s / system/ cookbooks / sudo/ t emp l a t e s / d e f a u l t :t o t a l 4−rw−r−−r−− 1 f r e d e r i c f r e d e r i c 780 Feb 9 14 :15 sudoe r s . e rb

Frederic Jaeckel (SoundCloud) Automatisierungstechnologien fur die Infrastruktur mit Chef

AboutWozu Automatisierung?

ChefExamples

Search

CookbooksCookbooksNode AttributesRolesData Bags

Recipes

Ein einfaches Recipe:

cat sudo/recipes/default.rb

## Cookbook Name : : sudo# Rec ipe : : d e f a u l t#

package ” sudo” doa c t i o n : upgrade

end

t emp la t e ”/ e t c / sudoe r s ” dos ou r c e ” sudoe r s . e rb ”mode 0644

end

Frederic Jaeckel (SoundCloud) Automatisierungstechnologien fur die Infrastruktur mit Chef

AboutWozu Automatisierung?

ChefExamples

Search

CookbooksCookbooksNode AttributesRolesData Bags

Recipes

Ein Recipe das Attributes nutzt:

cat sudo/recipes/default.rb

### Cookbook Name : : sudo## Rec ipe : : d e f a u l t###package ” sudo” do

a c t i o n : upgradeend

t emp la t e ”/ e t c / sudoe r s ” dos ou r c e ” sudoe r s . e rb ”mode 0644v a r i a b l e s (

: s u d o e r s g r o up s => node [ : a u t h o r i z a t i o n ] [ : sudo ] [ : g roups ] ,: s u d o e r s u s e r s => node [ : a u t h o r i z a t i o n ] [ : sudo ] [ : u s e r s ]

)end

Frederic Jaeckel (SoundCloud) Automatisierungstechnologien fur die Infrastruktur mit Chef

AboutWozu Automatisierung?

ChefExamples

Search

CookbooksCookbooksNode AttributesRolesData Bags

Node Attributes

JSON

drei Prioritaeten

defaultdie default variablenormalueberschreibt defaultoverrideueberschreibt alles

knife node showtest.host.name.de

{”name ” : ” t e s t . ho s t . name . de ” ,” j s o n c l a s s ” : ”Chef : : Node ” ,” automat i c ” : {

” a s s e t ” : {}} ,” normal ” : {} ,” c h e f t y p e ” : ”node ” ,” d e f a u l t ” : {

” a s s e t ” : {}} ,” o v e r r i d e ” : {

” a s s e t ” : {}} ,” r u n l i s t ” : []

}

Frederic Jaeckel (SoundCloud) Automatisierungstechnologien fur die Infrastruktur mit Chef

AboutWozu Automatisierung?

ChefExamples

Search

CookbooksCookbooksNode AttributesRolesData Bags

Node Attributes

JSON

drei Prioritaeten

defaultdie default variablenormalueberschreibt defaultoverrideueberschreibt alles

knife node showtest.host.name.de

{”name ” : ” t e s t . ho s t . name . de ” ,” j s o n c l a s s ” : ”Chef : : Node ” ,” automat i c ” : {

” a s s e t ” : {}} ,” normal ” : {} ,” c h e f t y p e ” : ”node ” ,” d e f a u l t ” : {

” a s s e t ” : {}} ,” o v e r r i d e ” : {

” a s s e t ” : {}} ,” r u n l i s t ” : []

}

Frederic Jaeckel (SoundCloud) Automatisierungstechnologien fur die Infrastruktur mit Chef

AboutWozu Automatisierung?

ChefExamples

Search

CookbooksCookbooksNode AttributesRolesData Bags

Node Attributes

JSON

drei Prioritaeten

defaultdie default variablenormalueberschreibt defaultoverrideueberschreibt alles

knife node showtest.host.name.de

{”name ” : ” t e s t . ho s t . name . de ” ,” j s o n c l a s s ” : ”Chef : : Node ” ,” automat i c ” : {

” a s s e t ” : {}} ,” normal ” : {} ,” c h e f t y p e ” : ”node ” ,” d e f a u l t ” : {

” a s s e t ” : {}} ,” o v e r r i d e ” : {

” a s s e t ” : {}} ,” r u n l i s t ” : []

}

Frederic Jaeckel (SoundCloud) Automatisierungstechnologien fur die Infrastruktur mit Chef

AboutWozu Automatisierung?

ChefExamples

Search

CookbooksCookbooksNode AttributesRolesData Bags

Node Attributes

cat sudo/attributes/default.rb

## Cookbook Name : : sudo# A t t r i b u t e F i l e : : s udoe r s#

d e f a u l t [ : a u t h o r i z a t i o n ] [ : sudo ] [ : g roups ] = Array . newd e f a u l t [ : a u t h o r i z a t i o n ] [ : sudo ] [ : u s e r s ] = Array . new

Frederic Jaeckel (SoundCloud) Automatisierungstechnologien fur die Infrastruktur mit Chef

AboutWozu Automatisierung?

ChefExamples

Search

CookbooksCookbooksNode AttributesRolesData Bags

Roles

Roles aggregieren Recipes und Attribute:

cat roles/webserver.rb

name ” webs e r v e r ”d e s c r i p t i o n ”Webserver ”r u n l i s t ” r e c i p e [ ng inx : : d e f a u l t ] ” ,

” r e c i p e [ ng inx : : mon i to r ] ” ,” r e c i p e [ php : : d e f a u l t ] ” ,” r e c i p e [ mysuperwebapp ] ”

d e f a u l t a t t r i b u t e s (’ nag io s ’ => {’ s e r v i c e s ’ => {

’ webse rve r ’ => {”Nginx ” => { ”check command”=>”che ck ng i n x ” }

}}})

Frederic Jaeckel (SoundCloud) Automatisierungstechnologien fur die Infrastruktur mit Chef

AboutWozu Automatisierung?

ChefExamples

Search

CookbooksCookbooksNode AttributesRolesData Bags

Data Bags

Speichern von Daten die Node uebergreifend verwendetwerden

Data Bags koennen verschluesselt werden

knife data bag passwords mysql

{” i d ” : ”mysql ” ,” pas s ” : ”trywgFA6R70NO28PNhMpGhEvKBZuxouemnbnAUQsUyo=\n” ,” u s e r ” : ”e/p+8WJYVHY9fHcEgAAReg==\n”

}

Frederic Jaeckel (SoundCloud) Automatisierungstechnologien fur die Infrastruktur mit Chef

AboutWozu Automatisierung?

ChefExamples

Search

CookbooksCookbooksNode AttributesRolesData Bags

Data Bags

knife data bag show –secret file /tmp/my data bag key passwordsmysql

{” i d ” : ”mysql ” ,” pas s ” : ” t h e s e c r e t 1 2 3 ” ,” u s e r ” : ” f r e d ”

}

Im Cookbook

mysq l c r e d s = Chef : : EncryptedDataBagItem . l oad ( ” passwords ” , ”mysql ” , s e c r e t )my sq l c r e d s [ ” pas s ” ] # w i l l be dec r yp t ed

Frederic Jaeckel (SoundCloud) Automatisierungstechnologien fur die Infrastruktur mit Chef

AboutWozu Automatisierung?

ChefExamples

Search

Search

Die Suche in Chef

Nach jedem Objekt in Chef kann gesucht werden:

Nodes, Clients

Roles, Recipes

Attributes

und vieles mehr

Frederic Jaeckel (SoundCloud) Automatisierungstechnologien fur die Infrastruktur mit Chef

AboutWozu Automatisierung?

ChefExamples

Search

Search

Die Suche nach Dingen

knife search node “model name:Intel*“

{” t o t a l ” : 1 ,” s t a r t ” : 0 ,” rows ” : [{

” r u n l i s t ” : [” r o l e [ base ] ” ,” r o l e [1337 r o l e ] ” ,” r e c i p e [ apache ] ”

] ,” i d ” : ” t e s t . ho s t . name . de”

}]

}

Frederic Jaeckel (SoundCloud) Automatisierungstechnologien fur die Infrastruktur mit Chef

AboutWozu Automatisierung?

ChefExamples

Search

Search

Weiterfuehrende Links

http://www.opscode.com/http://wiki.opscode.com/display/chef/http://www.ruby-lang.org/en/http://blog.opscode.com/http://soundcloud.com/jobs (We’re hiring ;)

Frederic Jaeckel (SoundCloud) Automatisierungstechnologien fur die Infrastruktur mit Chef

AboutWozu Automatisierung?

ChefExamples

Search

Search

The End

Danke fuer die Aufmerksamkeit!Fragen?

Frederic Jaeckel (SoundCloud) Automatisierungstechnologien fur die Infrastruktur mit Chef