33
Introduction to Chef

Introduction to Chef

Embed Size (px)

Citation preview

Introductionto Chef

What is DevOps?

DevelopersIt works on my machine

I need Java 1.7

BTW the deployment is due tomorrow

SysAdmin

We don’t support that version

The architecture doesn’t match our network, deployment or security model

We weren’t consulted about security/monitoring/backup/provisioning

The wall of confusion

The constant battle ...Change

VS

Stability

We Should talk!

We Should talk!

DevOpsEmphasizes

● Communication● Collaboration● Integration

between developers and operations.

Chef● Open source configuration management tool● Works best when developers and operations work

together● “DevOps” is not a must for Chef to be successful● But it helps

Your infrastructure becomes ...● Testable● Versioned● Repeatable● Distributable

Chef major components● Chef server● Chef client● Workstation

Chef Architecture

Chef key concepts● Organizations● Environments● Roles● Nodes● Recipes● Cookbooks● Knife● Ohai

Organizations● A single instance of chef server can support multiple

organizations● Each organization has a unique set of groups and users● Share nothing with other organizations● May represent different

○ Companies○ Business units○ Departments

Environments● Model the life-stages of your applications● Every organization starts with a single environment● Environments to reflect your patterns and workflow

○ Development○ Test○ Staging○ Production

Roles● Represent the type of servers in your

infrastructure○ Load balancer○ Application server○ Database○ Monitoring

Nodes● Nodes represent the servers in your

infrastructure● Can be either physical or virtual servers● Can be hardware that you own or can be

compute instances in a public or private cloud

Nodes...● Chef client runs on each node● Chef client will

○ Gather current system configurations○ Download the desired system configuration from

chef server○ Configure the node such that it adheres to the policy

Resources● A resource represents a piece of the system

and its desired state○ A package that should be installed○ A service which should be running○ A file which should be generated○ A cron job that should be configured○ A user that should be managed○ And more

Resources in recipes● Resources are the fundamental building

blocks of chef configuration● Resources are gathered into recipes● Recipes ensure the system is in the desired

state

Recipes● Configuration files that describe resources

and their desired state● Recipes can:

○ Install and configure software components○ Manage files○ Deploy applications○ Execute other recipes○ and more

Cookbooks● Recipes are stored in cookbooks● Cookbooks contain recipes, templates, files,

custom resources, etc● Code re-use and modularity

Run Lists● The Run list is a collection of policies that

the node should follow.● Chef-client obtains the run list from chef-

server● Chef-client ensures the node complies with

the policy in the run list

KnifeA CLI that provides an interface between a Workstation and the Chef Server. It manages,

● Nodes● Cookbooks and recipes● Roles● Environments● Cloud resources

Ohai● Detects attributes on a node● Provide attributes to chef-client● Type of attributes Ohai collects

○ Platform details○ Network usage○ Memory usage○ CPU data○ Kernal data○ and many more

Flavors of Chef

Flavors of Chef● Hosted Enterprise Chef

○ SaaS, Hosted at Opscode○ Manage up to 50,000 servers○ 24x7 support○ Pay/Grow as you need○ Free upto 5 nodes

Flavors of Chef ● Enterprise Chef

○ All the power of Hosted Chef, behind the firewall○ Delivered as enterprise software○ Free of charge up to 5 nodes○ Customer needs to take care of provisioning the

infrastructure

Flavors of Chef ● Open Source Chef Server

○ Core components of Chef Server are released as open source

○ No enterprise features (yet people use them)○ No enterprise support

Flavors of Chef ● Chef-solo

○ Allows using cookbooks on nodes without requiring a chef-server

○ Runs locally and requires cookbooks to be on the same machine

○ A limited version of the chef-client

Learn Chef!

Let’s Learn Chef

● https://learn.chef.io● https://docs.chef.io● https://www.chef.io/resources/solutions● https://www.youtube.com/user/Opscode

Thank You!