53
PuppetConf 2013

Case Study: Green Field Implementation of Puppet 3.0 at ESPN

Embed Size (px)

DESCRIPTION

At the end of 2012 ESPN undertook an effort to modernize its deployment and maintenance of linux based platform services. ESPN faced a challenging problem in that hundreds of servers needed to be puppetized yet the largest cluster of identical servers was only eight servers. Therefore having a puppet environment that was flexible, consistent, simple to understand and data driven was critical to success. This session looks at the architectural decisions made by ESPN while performing a green field implementation of Puppet 3.0 and reflects on the resulting good and bad of those decisions. Ben Schofield Senior Application Architect, ESPN Ben Schofield is the middleware architect for ESPN. With 11 years of IT experience working for Fortune 200 companies in the retail, insurance, financial and media industries, Ben has seen the good, bad and ugly of IT operations and management. He brings a unique perspective on how a well designed devops team with the right mind set can help large IT departments reduce costs and decrease time to market.

Citation preview

Page 1: Case Study: Green Field Implementation of Puppet 3.0 at ESPN

PuppetConf 2013

Page 2: Case Study: Green Field Implementation of Puppet 3.0 at ESPN

CHALLENGES

Page 3: Case Study: Green Field Implementation of Puppet 3.0 at ESPN

• Rapid growth– Number of servers being provisioned– New services being provided

• Manual configurations

• Drift

• Silos

• Traditional clouds not reasonable

Page 4: Case Study: Green Field Implementation of Puppet 3.0 at ESPN

Objectives

Page 5: Case Study: Green Field Implementation of Puppet 3.0 at ESPN

• Push button configuration

• Self service for customers

• Visibility into state of configurations– Reports

• Simplify knowledge transfer

• Data driven

• Elastic

• Build/rebuild a node at anytime

Page 6: Case Study: Green Field Implementation of Puppet 3.0 at ESPN

• Support workstations/dev/test/prod

• Allow adhoc manual changes*

• Do not slow down development teams

• Include legacy servers

Page 7: Case Study: Green Field Implementation of Puppet 3.0 at ESPN

Application

Middleware

OS

Server

Storage

Network

IAAS

PAAS

SAAS

Puppet

Page 8: Case Study: Green Field Implementation of Puppet 3.0 at ESPN

Puppet Versions

• Puppet 3.0.0

• Puppet Dashboard 1.2.12

• PuppetDB 1.0.1

• MCollective 2.2.1

• ActiveMQ 5.5

Page 9: Case Study: Green Field Implementation of Puppet 3.0 at ESPN

The Data

Page 10: Case Study: Green Field Implementation of Puppet 3.0 at ESPN

• Inherent Facts – Facter– Exists simply because the node exists.

• Derived Facts – Business rules applied to inherent facts.– Puppet custom facts

• Assigned Facts – Exist because we deem it to be true.– Top or node scoped variables

Page 11: Case Study: Green Field Implementation of Puppet 3.0 at ESPN

Assigned Facts• espn_role

– Identifes the role class to be applied• espn_cluster

– Identifies nodes in the cluster• espn_env

– workstation, dev, test, qa, prod• espn_owner

– change notifications– security delegation – licensing

Page 12: Case Study: Green Field Implementation of Puppet 3.0 at ESPN

What to manage? Everything!

Page 13: Case Study: Green Field Implementation of Puppet 3.0 at ESPN

Role

• Aligns with business and or IT needs

• Defines everything on a node

• Used for classification of nodes

• Exactly one role per node

• Includes profiles and releases

• espn_role

Page 14: Case Study: Green Field Implementation of Puppet 3.0 at ESPN

Group everything by roles

AA BB CC

Page 15: Case Study: Green Field Implementation of Puppet 3.0 at ESPN

Release Environment

• Not puppet environments

• Determined by application development and release cycle

• espn_env

Page 16: Case Study: Green Field Implementation of Puppet 3.0 at ESPN

Group by release environment

AA BB CC

ProdProd

QAQA

DevDev

WorkWork

Page 17: Case Study: Green Field Implementation of Puppet 3.0 at ESPN

Clusters

• Always identical

• Configured to interact with one another

• espn_cluster

Page 18: Case Study: Green Field Implementation of Puppet 3.0 at ESPN

Group by clusters

AA BB CC

ProdProd

QAQA

DevDev

WorkWork

Page 19: Case Study: Green Field Implementation of Puppet 3.0 at ESPN

Hiera hierarchy in theoryhostname/%{hostname}

cluster/%{espn_cluster_name}

role_env/%{espn_role}_%{espn_env}

role/%{espn_role}

env/%{espn_env}

network/%{espn_network}

os/%{operationsystem}

default

Page 20: Case Study: Green Field Implementation of Puppet 3.0 at ESPN

Hiera hierarchy in practice

role_env/%{espn_role}_%{espn_env}

role/%{espn_role}

env/%{espn_env}

network/%{espn_network}

defaults

Page 21: Case Study: Green Field Implementation of Puppet 3.0 at ESPN

Classification

Page 22: Case Study: Green Field Implementation of Puppet 3.0 at ESPN

Application

Middleware

OS

Server

Storage

Network

IAAS

PAAS

SAAS

Role

Profiles

Releases

Page 23: Case Study: Green Field Implementation of Puppet 3.0 at ESPN

Role

Profiles

Releases Resources

Resources

Classes Resources

Resource Hierarchy

Page 24: Case Study: Green Field Implementation of Puppet 3.0 at ESPN

Resources

• The building blocks

• Everything managed is a resource

• Defined in modules, used by profiles

• Two resources never manage the same configuration

Page 25: Case Study: Green Field Implementation of Puppet 3.0 at ESPN

Modules

• Isolate resources within the module

• Never reference another module

• No organizational specific logic

• init.pp is a minimal installer

• Reusability is key

Page 26: Case Study: Green Field Implementation of Puppet 3.0 at ESPN

R RR RR RR R

R RR RR RR R

R RR RR RR R

R RR RR RR R

R RR RR RR R

Resources by module

Page 27: Case Study: Green Field Implementation of Puppet 3.0 at ESPN

R RR RR RR R

R RR RR RR R

R RR RR RR R

R RR RR RR R

R RR RR RR R

Never cross modules

Page 28: Case Study: Green Field Implementation of Puppet 3.0 at ESPN

Role

Profiles

Releases Resources

Resources

Classes Resources

Resource Hierarchy

Page 29: Case Study: Green Field Implementation of Puppet 3.0 at ESPN

Profile

• Defines the platform

• Cross module references

• Enforces dependencies between modules

• Class parameters prevent hiera overrides

Page 30: Case Study: Green Field Implementation of Puppet 3.0 at ESPN

Example Profileclass profile::jboss_eap_6(

$java_version=‘jdk_1_7_u10’,

$mod_cluster_version=‘1.2.3’,

$httpd_version=‘2.2.22’,

){

include “java::${java_version}”

include directories::middleware

class{‘mod_cluster’:

version => $mod_cluster_version,}

class{‘httpd’:

version => $httpd_version,}

class{‘jboss_eap_6’:

java_home => getvar(“java::${java_version}::home”),}

}

Page 31: Case Study: Green Field Implementation of Puppet 3.0 at ESPN

Role

Profiles

Releases Resources

Resources

Classes Resources

Resource Hierarchy

Page 32: Case Study: Green Field Implementation of Puppet 3.0 at ESPN

Release

• Special type of profile

• Knows how to install on top of a profile

• Deploys resources from an “artifact hash”

• Cleans up removed artifacts

• Driven by versioned release id– espn_release_id

Page 33: Case Study: Green Field Implementation of Puppet 3.0 at ESPN

Artifact Hash

• Defines abstract resources in a release

• Contract between developers and operational groups

• Profile agnostic

Page 34: Case Study: Green Field Implementation of Puppet 3.0 at ESPN

Example Artifact Hashapplications

‘jee-app.ear’:

version: 1.2.3

espn.war:

version: 1.0.0

datasources:

datasource1:

driver_name: ”oracle”

libraries:

utility.jar:

version: 1.0.0

Page 35: Case Study: Green Field Implementation of Puppet 3.0 at ESPN

Example ReleaseClass release::studio_record{

artifact_hash = hiera(‘artifacts’,undef,”release/${espn_release_id}”)

#modify the artifact hash so it can be used with create_resources

#set organization specific parameters such URL’s to the artifact repo

resources {‘jboss7_datasource: purge => true,}

create_resources(jboss7_datasource, $artifact_hash[‘datasources’])

resources {‘jboss7_deployment: purge => true,}

create_resources(jboss7_deployment, $artifact_hash[‘applications’])

}

Page 36: Case Study: Green Field Implementation of Puppet 3.0 at ESPN

Role

Profiles

Releases Resources

Resources

Classes Resources

Resource Hierarchy

Page 37: Case Study: Green Field Implementation of Puppet 3.0 at ESPN

Example Role

class role::studio_record{

include profile::base

include profile::jboss_eap_6

include profile::mysql_5

include release::studio_record

}

Page 38: Case Study: Green Field Implementation of Puppet 3.0 at ESPN

site.pp

# assigned facts retrieved from external datasources

$espn_cluster_nodes = espn_cluster_nodes()

$espn_release_id = hiera(‘espn_release_id’)

# single assigned fact drives 100% of classification

node default {

include “role::${espn_role}”

}

Page 39: Case Study: Green Field Implementation of Puppet 3.0 at ESPN

Defining a Node

Page 40: Case Study: Green Field Implementation of Puppet 3.0 at ESPN

MCollective

Page 41: Case Study: Green Field Implementation of Puppet 3.0 at ESPN

Colonol John Boyd• Military Strategist

• OODA Loop

Page 42: Case Study: Green Field Implementation of Puppet 3.0 at ESPN

ObservationsDecision

(Hypothesis)Action(Test)

Observe Orient Decide Act

Feedback

Feedback

UnfoldingCircumstances

OutsideInformation

UnfoldingInteraction

WithEnvironment

CulturalTraditions

Analysis &Synthesis

PreviousExperience

NewInformation

GeneticHeritage

Feedback

ImplicitGuidance& Control

ImplicitGuidance& Control

Page 43: Case Study: Green Field Implementation of Puppet 3.0 at ESPN

OODA Loop

"Time is the dominant parameter. The pilot who goes through the OODA cycle in the shortest time prevails because his opponent is caught responding to situations that have already changed.“

Harry Hillaker (chief designer of the F-16)

Page 44: Case Study: Green Field Implementation of Puppet 3.0 at ESPN

ObservationsDecision

(Hypothesis)Action(Test)

Observe Orient Decide Act

Feedback: Puppet runs on dev/test puppet environments

Feedback

UnfoldingCircumstances

OutsideInformation

UnfoldingInteraction

WithEnvironment

CulturalTraditions

Analysis &Synthesis

PreviousExperience

NewInformation

GeneticHeritage

Feedback

ImplicitGuidance& Control

ImplicitGuidance& Control

Page 45: Case Study: Green Field Implementation of Puppet 3.0 at ESPN

ObservationsDecision

(Hypothesis)Action(Test)

Observe Orient Decide Act

Feedback: Puppet runs on dev/test puppet environments

Feedback: (Test) Noop puppet run on production

UnfoldingCircumstances

OutsideInformation

UnfoldingInteraction

WithEnvironment

CulturalTraditions

Analysis &Synthesis

PreviousExperience

NewInformation

GeneticHeritage

Feedback

ImplicitGuidance& Control

ImplicitGuidance& Control

Page 46: Case Study: Green Field Implementation of Puppet 3.0 at ESPN

Noop Puppet Runs

• Hourly cron job– “mco puppet runall 20 –noop”

• Dashboard displays unresponsive nodes– no_longer_reporting_cutoff

Page 47: Case Study: Green Field Implementation of Puppet 3.0 at ESPN

ObservationsDecision

(Hypothesis)Action(Test)

Observe Orient Decide Act

Feedback: Puppet runs on dev/test puppet environments

Feedback: (Test) Noop puppet run on production

UnfoldingCircumstances

OutsideInformation

UnfoldingInteraction

WithEnvironment

PuppetDashboard

CulturalTraditions

Analysis &Synthesis

PreviousExperience

NewInformation

GeneticHeritage

Feedback: (Action) No-noop puppet run on production

ImplicitGuidance& Control

ImplicitGuidance& Control

Page 48: Case Study: Green Field Implementation of Puppet 3.0 at ESPN

Configuration Changes• Always noop first

• Always target nodes with filters

• Always use tags

• Validate changes then apply –no-noop

mco puppet runonce --no-noop -C jboss-eap-6 --tag initscript --tag jboss-eap-6

Page 49: Case Study: Green Field Implementation of Puppet 3.0 at ESPN

ObservationsDecision

(Hypothesis)Action(Test)

Observe Orient Decide Act

Feedback: Puppet runs on dev/test puppet environments

Feedback: (Test) Noop puppet run on production

UnfoldingCircumstances

OutsideInformation

CulturalTraditions

Analysis &Synthesis

PreviousExperience

NewInformation

GeneticHeritage

Feedback: (Action) No-noop puppet run on production

Implicit Guidance & Control:MCollective Agent Plugins

ImplicitGuidance& Control

UnfoldingInteraction

WithEnvironment

PuppetDashboard

Page 50: Case Study: Green Field Implementation of Puppet 3.0 at ESPN

20/20 Hindsight

Page 51: Case Study: Green Field Implementation of Puppet 3.0 at ESPN

Do Differently?

• Implement MCollective first– Security– Sub-collectives– Availability

• Plan for developer dashboards

• Implement Custom ENC

Page 52: Case Study: Green Field Implementation of Puppet 3.0 at ESPN

Nice to have?

• Puppet runs that span multiple nodes– Allocate disk on node A, create shared

filesystem on node B

• Resources automatically tagged with catalog unique identifiers

• Role based access control for dashboard

Page 53: Case Study: Green Field Implementation of Puppet 3.0 at ESPN

Questions?