SlideShare une entreprise Scribd logo
1  sur  38
Télécharger pour lire hors ligne
Ryan Park / rpark@pinterest.com




Slide Title




                    Download slides and code samples at:
              https://github.com/pinterest/puppetconf
Ryan Park / rpark@pinterest.com
Ryan Park / rpark@pinterest.com




           Web Application
              Servers




             Internal
            Web Services




Memcache       MySQL         Redis
Ryan Park / rpark@pinterest.com




Before Puppet

 ‣   150 virtual servers: web app, MySQL,
     Memcache, Membase, Redis,
     Elastic Search...
 ‣   12 Amazon Machine Images
 ‣   cut -f 1 ~/.ssh/known_hosts
Ryan Park / rpark@pinterest.com




Puppet Dashboard

  ‣   The “source of truth” about what’s
      running in our infrastructure
  ‣   Alternatives we considered
      ‣   Puppet manifests: only useful in Puppet
      ‣   LDAP: difficult to set up
      ‣   Foreman: too much for our needs
Ryan Park / rpark@pinterest.com




Puppet Dashboard

  ‣   Problem: Some
      dependencies are
      configured in Puppet
      Dashboard, others in
      Puppet manifests

  ‣   Solution: Define your
      dependencies in Puppet
      manifests when possible
Ryan Park / rpark@pinterest.com




Puppet Dashboard

  ‣   Node Groups are useful…

  ‣   …but more useful when
      you can use the data to
      power other systems.

  ‣   ...and even more useful
      when you combine
      Puppet Dashboard data
      with storedconfigs.
Ryan Park / rpark@pinterest.com




REST API


    [ryan@mac:~]$ curl https://puppet-dashboard/api/
    {
        "nodes": "https://puppet-dashboard/api/node",
        "node_classes": "https://puppet-dashboard/api/class",
        "node_groups": "https://puppet-dashboard/api/group"
    }




                      Self-documenting and
                      nicely formatted
Ryan Park / rpark@pinterest.com




[ryan@mac:~]$ curl https://puppet-dashboard/api/group/
[
    {
        "name": "datalayer",
        "url": "https://puppet-dashboard/api/group/datalayer"
    },
    {
        "name": "follower",
        "url": "https://puppet-dashboard/api/group/follower"
    },
    {
        "name": "mysql",
        "url": "https://puppet-dashboard/api/group/mysql"
    },
    ...
]
Ryan Park / rpark@pinterest.com




Node Group API
Ryan Park / rpark@pinterest.com




Node Group API
Ryan Park / rpark@pinterest.com




Node Group API


    [ryan@mac:~]$ curl https://puppet-dashboard/api/group/follower_redis
    {
        "nodes": ...,
        "node_classes": ...,
        "parameters": ...,
        "ancestors": ...,
        "descendants": ...
    }
"nodes": [
    {
             "name": "followerredis001a",
             "href": "https://puppet-dashboard/api/node/followerredis001a",
             "source": {
                 "type": "node_group",
                 "name": "follower_redis",
                 "href": "https://puppet-dashboard/api/group/follower_redis"
             }
    },
    {
             "name": "followerredis001b",
             "href": "https://puppet-dashboard/api/node/followerredis001b",
             "source": {
                 "type": "node_group",
                 "name": "follower_redis",
                 "href": "https://puppet-dashboard/api/group/follower_redis"
         }
    },
]
"node_classes": [
    {
         "name": "redis",
         "href": "https://puppet-dashboard/api/class/redis",
         "source": {
             "type": "node_group",
             "name": "redis",
             "href": "https://puppet-dashboard/api/group/redis"
         }
    },
    {
         "name": "redis::backup",
         "href": "https://puppet-dashboard/api/class/redis::backup",
         "source": {
             "type": "node_group",
             "name": "follower_redis",
             "href": "https://puppet-dashboard/api/group/follower_redis"
         }
    }
]
"parameters": {
    "swapfile_size": {
        "key": "swapfile_size",
        "value": "10240",
        "source": {
            "type": "node_group",
            "name": "follower_redis",
            "href": "https://puppet-dashboard/api/group/follower_redis"
        }
    }
}
Ryan Park / rpark@pinterest.com




Node API
Ryan Park / rpark@pinterest.com




Node API


    [ryan@mac:~]$ curl https://puppet-dashboard/api/node/followerredis001a
    {
        "status": "unchanged",
        "node_groups": ...,
        "node_classes": ...,
        "facts": ...,
        "parameters": ...
    }
"facts": {
     "ipaddress": "10.131.60.134",
     "operatingsystem": "Ubuntu",
     "kernelversion": "2.6.38",
     "ec2_instance_id": "i-17500aaf",
     "ec2_instance_type": "m2.2xlarge",
     "ec2_placement_availability_zone": "us-east-1a"
},
"parameters": {
     "swapfile_size": {
         "key": "swapfile_size",
         "value": "10240",
         "source": {
             "type": "node_group",
             "name": "follower_redis",
             "href": "https://puppet-dashboard/api/group/follower_redis"
         }
     }
}
Ryan Park / rpark@pinterest.com




Sample API Client
     [ryan@mac:~]$ cat puppet_to_hosts.py
     import json
     import urllib2

     def download_and_decode(url):
         request = urllib2.Request(url)
         response = urllib2.urlopen(request)
         return json.loads(response.read())

     def main():
         data = download_and_decode("http://puppet-dashboard/api/node/")
         for node in data['nodes']:
             if node.has_key('ipaddress') and node['ipaddress']:
                 print node['ipaddress'] + " " + node['name']

     if __name__ == "__main__":
         main()
Ryan Park / rpark@pinterest.com




Sample API Client
     [ryan@mac:~]$ python puppet_to_hosts.py
     10.150.39.222 azkaban001
     10.169.164.132 datalayer001
     10.39.63.178 datalayer002
     10.97.34.202 datalayer003
     10.112.144.31 datalayer004
     10.49.10.163 followerredis001a
     10.18.185.220 followerredis001b
Ryan Park / rpark@pinterest.com




Our API Clients

 ‣   Generate /etc/hosts file
 ‣   Generate Monit configuration files
 ‣   Push hostnames to Amazon Route 53
     DNS service
 ‣   Remove SSL certificates (puppetca
     --clean) for nodes that have been deleted
     from Puppet Dashboard
Ryan Park / rpark@pinterest.com




Our API Clients

 ‣   Source code deploy tools
 ‣   Monitoring dashboards
 ‣   Metrics dashboards
Ryan Park / rpark@pinterest.com




Puppet and
Amazon EC2
Ryan Park / rpark@pinterest.com




Bootstrapping EC2

 ‣   One custom image for all our instances
     ‣   Start with a basic Ubuntu AMI.
     ‣   Add packages facter, puppet, and
         ec2-api-tools.
     ‣   Modify /etc/rc.local to run Puppet when
         the instance launches.
Ryan Park / rpark@pinterest.com




We Cheat

  ‣   Problem: Using Puppet to install all our
      dependencies is too slow—it would take
      20 minutes to launch an instance.
  ‣   Solution: We pre-install about 60
      Debian packages and 60 Python
      packages.
Ryan Park / rpark@pinterest.com




EC2 Hostnames

  ‣   Problem: EC2 instance hostnames look
      like “ip-10-113-111-43.ec2.internal.”
  ‣   Solution: Set the hostname when
      booting the instance.
Ryan Park / rpark@pinterest.com




/etc/rc.local

      [ryan@followerredis001a:~]$ cat /etc/rc.local

      #!/bin/bash


      # Use ec2-api-tools to determine our instance name.

      # /etc/aws/cert.pem and /etc/aws/pk.pem must be present on the AMI,

      # along with the Debian packages ec2-api-tools and facter.

      export EC2_CERT=/etc/aws/cert.pem
      export EC2_PRIVATE_KEY=/etc/aws/pk.pem

      INSTANCE_ID=`facter ec2_instance_id`

      INSTANCE_NAME=`ec2-describe-tags --filter "key=Name" 
          --filter "resource-type=instance" 
          --filter "resource-id=$INSTANCE_ID" | sed 's/.*t//g'`
# Set the hostname to $INSTANCE_NAME.example.com
hostname $INSTANCE_NAME
echo $INSTANCE_NAME > /etc/hostname

sed -i "s/^domain .*$/domain example.com/g" /etc/resolv.conf

sed -i "s/^search .*$/search example.com/g" /etc/resolv.conf
IP_ADDRESS=`facter ipaddress_eth0`
echo "# Additional entries added by bootstrap script" >> /etc/hosts

echo "$IP_ADDRESS $INSTANCE_NAME.example.com $INSTANCE_NAME" 

    >> /etc/hosts


# Puppet will configure this instance based on the classes in the

# Puppet Dashboard.

puppet agent --onetime
Ryan Park / rpark@pinterest.com




EC2 Auto Scaling
            Busy     Provisioned

80




60




40




20




 0
  5AM       12PM   7PM                  2AM
Ryan Park / rpark@pinterest.com




EC2 Auto Scaling
            Busy     Provisioned

80




60




40




20




 0
  5AM       12PM   7PM                  2AM
Ryan Park / rpark@pinterest.com




EC2 Auto Scaling

  ‣   Problem: When using Puppet
      Dashboard as an external node
      classifier, every host must be declared
      explicitly in the Puppet Dashboard
      database.
  ‣   Solution: When a new instance starts,
      have it register itself in the Puppet
      Dashboard using our REST API.
Ryan Park / rpark@pinterest.com




EC2 Auto Scaling

  ‣   A POST to /api/provision/<node_group>
      adds a node to the Dashboard database
      and returns the hostname.
       [root@ip-10-88-155-31:~]# curl -X POST 
           https://puppet-dashboard/api/provision/datalayer


       datalayer005



  ‣   This endpoint returns the hostname as
      a string, not JSON.
Ryan Park / rpark@pinterest.com




EC2 Auto Scaling: /etc/rc.local

     # If there's no hostname, there may be a node group name in the
     # EC2 user-data string. Use the Puppet Dashboard API to request

     # a hostname in that node group.

     if [ -z "$INSTANCE_NAME" ]; then
          FILENAME="/var/lib/cloud/instances/$INSTANCE_ID/user-data.txt"
          if [ -f "$FILENAME" ]; then

               NODE_GROUP=`cat $FILENAME`

               if [ ! -z "$NODE_GROUP" ]; then
                    INSTANCE_NAME=`curl -X POST 
                       https://puppet-dashboard/api/provision/$NODE_GROUP`

               fi

          fi
     fi
Ryan Park / rpark@pinterest.com




After Puppet

 ‣   Hundreds of virtual servers in 60 host
     groups
 ‣   1 Amazon Machine Image
 ‣   Dozens of scripts pull data from
     Puppet Dashboard’s database
Ryan Park / rpark@pinterest.com




  We’re Hiring!
http://pinterest.com/about/careers
Ryan Park / rpark@pinterest.com




Contact
      rpark@pinterest.com

      ryanpark

      @StanfordRyan




                Download slides and code samples at:
          https://github.com/pinterest/puppetconf

Contenu connexe

Tendances

Our Puppet Story (Linuxtag 2014)
Our Puppet Story (Linuxtag 2014)Our Puppet Story (Linuxtag 2014)
Our Puppet Story (Linuxtag 2014)DECK36
 
Puppet for dummies - ZendCon 2011 Edition
Puppet for dummies - ZendCon 2011 EditionPuppet for dummies - ZendCon 2011 Edition
Puppet for dummies - ZendCon 2011 EditionJoshua Thijssen
 
PECL Picks - Extensions to make your life better
PECL Picks - Extensions to make your life betterPECL Picks - Extensions to make your life better
PECL Picks - Extensions to make your life betterZendCon
 
Replacing "exec" with a type and provider: Return manifests to a declarative ...
Replacing "exec" with a type and provider: Return manifests to a declarative ...Replacing "exec" with a type and provider: Return manifests to a declarative ...
Replacing "exec" with a type and provider: Return manifests to a declarative ...Puppet
 
Testing for Ops: Going Beyond the Manifest - PuppetConf 2013
Testing for Ops: Going Beyond the Manifest - PuppetConf 2013Testing for Ops: Going Beyond the Manifest - PuppetConf 2013
Testing for Ops: Going Beyond the Manifest - PuppetConf 2013Puppet
 
Bootstrapping Puppet and Application Deployment - PuppetConf 2013
Bootstrapping Puppet and Application Deployment - PuppetConf 2013Bootstrapping Puppet and Application Deployment - PuppetConf 2013
Bootstrapping Puppet and Application Deployment - PuppetConf 2013Puppet
 
Oliver hookins puppetcamp2011
Oliver hookins puppetcamp2011Oliver hookins puppetcamp2011
Oliver hookins puppetcamp2011Puppet
 
Cooking Perl with Chef
Cooking Perl with ChefCooking Perl with Chef
Cooking Perl with ChefDavid Golden
 
Twig: Friendly Curly Braces Invade Your Templates!
Twig: Friendly Curly Braces Invade Your Templates!Twig: Friendly Curly Braces Invade Your Templates!
Twig: Friendly Curly Braces Invade Your Templates!Ryan Weaver
 
Writing Custom Puppet Types and Providers to Manage Web-Based Applications
Writing Custom Puppet Types and Providers to Manage Web-Based ApplicationsWriting Custom Puppet Types and Providers to Manage Web-Based Applications
Writing Custom Puppet Types and Providers to Manage Web-Based ApplicationsTim Cinel
 
Deploying Symfony | symfony.cat
Deploying Symfony | symfony.catDeploying Symfony | symfony.cat
Deploying Symfony | symfony.catPablo Godel
 
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQueryRemedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQueryTatsuhiko Miyagawa
 
Master the New Core of Drupal 8 Now: with Symfony and Silex
Master the New Core of Drupal 8 Now: with Symfony and SilexMaster the New Core of Drupal 8 Now: with Symfony and Silex
Master the New Core of Drupal 8 Now: with Symfony and SilexRyan Weaver
 

Tendances (20)

Our Puppet Story (Linuxtag 2014)
Our Puppet Story (Linuxtag 2014)Our Puppet Story (Linuxtag 2014)
Our Puppet Story (Linuxtag 2014)
 
Puppet - an introduction
Puppet - an introductionPuppet - an introduction
Puppet - an introduction
 
Puppet for dummies - ZendCon 2011 Edition
Puppet for dummies - ZendCon 2011 EditionPuppet for dummies - ZendCon 2011 Edition
Puppet for dummies - ZendCon 2011 Edition
 
PECL Picks - Extensions to make your life better
PECL Picks - Extensions to make your life betterPECL Picks - Extensions to make your life better
PECL Picks - Extensions to make your life better
 
Replacing "exec" with a type and provider: Return manifests to a declarative ...
Replacing "exec" with a type and provider: Return manifests to a declarative ...Replacing "exec" with a type and provider: Return manifests to a declarative ...
Replacing "exec" with a type and provider: Return manifests to a declarative ...
 
Testing for Ops: Going Beyond the Manifest - PuppetConf 2013
Testing for Ops: Going Beyond the Manifest - PuppetConf 2013Testing for Ops: Going Beyond the Manifest - PuppetConf 2013
Testing for Ops: Going Beyond the Manifest - PuppetConf 2013
 
Bootstrapping Puppet and Application Deployment - PuppetConf 2013
Bootstrapping Puppet and Application Deployment - PuppetConf 2013Bootstrapping Puppet and Application Deployment - PuppetConf 2013
Bootstrapping Puppet and Application Deployment - PuppetConf 2013
 
Maven 3.0 at Øredev
Maven 3.0 at ØredevMaven 3.0 at Øredev
Maven 3.0 at Øredev
 
Getting Started With Aura
Getting Started With AuraGetting Started With Aura
Getting Started With Aura
 
Oliver hookins puppetcamp2011
Oliver hookins puppetcamp2011Oliver hookins puppetcamp2011
Oliver hookins puppetcamp2011
 
Cooking Perl with Chef
Cooking Perl with ChefCooking Perl with Chef
Cooking Perl with Chef
 
Puppet modules for Fun and Profit
Puppet modules for Fun and ProfitPuppet modules for Fun and Profit
Puppet modules for Fun and Profit
 
Twig: Friendly Curly Braces Invade Your Templates!
Twig: Friendly Curly Braces Invade Your Templates!Twig: Friendly Curly Braces Invade Your Templates!
Twig: Friendly Curly Braces Invade Your Templates!
 
Puppi. Puppet strings to the shell
Puppi. Puppet strings to the shellPuppi. Puppet strings to the shell
Puppi. Puppet strings to the shell
 
Writing Custom Puppet Types and Providers to Manage Web-Based Applications
Writing Custom Puppet Types and Providers to Manage Web-Based ApplicationsWriting Custom Puppet Types and Providers to Manage Web-Based Applications
Writing Custom Puppet Types and Providers to Manage Web-Based Applications
 
Deploying Symfony | symfony.cat
Deploying Symfony | symfony.catDeploying Symfony | symfony.cat
Deploying Symfony | symfony.cat
 
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQueryRemedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
 
Plack - LPW 2009
Plack - LPW 2009Plack - LPW 2009
Plack - LPW 2009
 
Tatsumaki
TatsumakiTatsumaki
Tatsumaki
 
Master the New Core of Drupal 8 Now: with Symfony and Silex
Master the New Core of Drupal 8 Now: with Symfony and SilexMaster the New Core of Drupal 8 Now: with Symfony and Silex
Master the New Core of Drupal 8 Now: with Symfony and Silex
 

Similaire à Puppet at Pinterest

Burn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websitesBurn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websitesLindsay Holmwood
 
Docker for Ruby Developers
Docker for Ruby DevelopersDocker for Ruby Developers
Docker for Ruby DevelopersAptible
 
Puppet atbazaarvoice
Puppet atbazaarvoicePuppet atbazaarvoice
Puppet atbazaarvoiceDave Barcelo
 
How I Learned to Stop Worrying and Love the Cloud - Wesley Beary, Engine Yard
How I Learned to Stop Worrying and Love the Cloud - Wesley Beary, Engine YardHow I Learned to Stop Worrying and Love the Cloud - Wesley Beary, Engine Yard
How I Learned to Stop Worrying and Love the Cloud - Wesley Beary, Engine YardSV Ruby on Rails Meetup
 
How Bitbucket Pipelines Loads Connect UI Assets Super-fast
How Bitbucket Pipelines Loads Connect UI Assets Super-fastHow Bitbucket Pipelines Loads Connect UI Assets Super-fast
How Bitbucket Pipelines Loads Connect UI Assets Super-fastAtlassian
 
Docker Security workshop slides
Docker Security workshop slidesDocker Security workshop slides
Docker Security workshop slidesDocker, Inc.
 
High quality ap is with api platform
High quality ap is with api platformHigh quality ap is with api platform
High quality ap is with api platformNelson Kopliku
 
Puppetpreso
PuppetpresoPuppetpreso
Puppetpresoke4qqq
 
Puppet getting started by Dirk Götz
Puppet getting started by Dirk GötzPuppet getting started by Dirk Götz
Puppet getting started by Dirk GötzNETWAYS
 
Greenfield Puppet: Getting it right from the start
Greenfield Puppet: Getting it right from the startGreenfield Puppet: Getting it right from the start
Greenfield Puppet: Getting it right from the startDavid Danzilio
 
Puppet Camp Boston 2014: Greenfield Puppet: Getting it right from the start (...
Puppet Camp Boston 2014: Greenfield Puppet: Getting it right from the start (...Puppet Camp Boston 2014: Greenfield Puppet: Getting it right from the start (...
Puppet Camp Boston 2014: Greenfield Puppet: Getting it right from the start (...Puppet
 
Baking in the cloud with packer and puppet
Baking in the cloud with packer and puppetBaking in the cloud with packer and puppet
Baking in the cloud with packer and puppetAlan Parkinson
 
Harmonious Development: Via Vagrant and Puppet
Harmonious Development: Via Vagrant and PuppetHarmonious Development: Via Vagrant and Puppet
Harmonious Development: Via Vagrant and PuppetAchieve Internet
 
Puppet and the HashiStack
Puppet and the HashiStackPuppet and the HashiStack
Puppet and the HashiStackBram Vogelaar
 
Amazon Web Services and Docker: from developing to production
Amazon Web Services and Docker: from developing to productionAmazon Web Services and Docker: from developing to production
Amazon Web Services and Docker: from developing to productionPaolo latella
 
Puppet at Opera Sofware - PuppetCamp Oslo 2013
Puppet at Opera Sofware - PuppetCamp Oslo 2013Puppet at Opera Sofware - PuppetCamp Oslo 2013
Puppet at Opera Sofware - PuppetCamp Oslo 2013Cosimo Streppone
 

Similaire à Puppet at Pinterest (20)

Burn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websitesBurn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websites
 
Docker for Ruby Developers
Docker for Ruby DevelopersDocker for Ruby Developers
Docker for Ruby Developers
 
Puppet atbazaarvoice
Puppet atbazaarvoicePuppet atbazaarvoice
Puppet atbazaarvoice
 
My First Big Data Application
My First Big Data ApplicationMy First Big Data Application
My First Big Data Application
 
How I Learned to Stop Worrying and Love the Cloud - Wesley Beary, Engine Yard
How I Learned to Stop Worrying and Love the Cloud - Wesley Beary, Engine YardHow I Learned to Stop Worrying and Love the Cloud - Wesley Beary, Engine Yard
How I Learned to Stop Worrying and Love the Cloud - Wesley Beary, Engine Yard
 
How Bitbucket Pipelines Loads Connect UI Assets Super-fast
How Bitbucket Pipelines Loads Connect UI Assets Super-fastHow Bitbucket Pipelines Loads Connect UI Assets Super-fast
How Bitbucket Pipelines Loads Connect UI Assets Super-fast
 
Sprockets
SprocketsSprockets
Sprockets
 
Docker Security workshop slides
Docker Security workshop slidesDocker Security workshop slides
Docker Security workshop slides
 
High quality ap is with api platform
High quality ap is with api platformHigh quality ap is with api platform
High quality ap is with api platform
 
Puppetpreso
PuppetpresoPuppetpreso
Puppetpreso
 
Puppet getting started by Dirk Götz
Puppet getting started by Dirk GötzPuppet getting started by Dirk Götz
Puppet getting started by Dirk Götz
 
Intro to Rack
Intro to RackIntro to Rack
Intro to Rack
 
Greenfield Puppet: Getting it right from the start
Greenfield Puppet: Getting it right from the startGreenfield Puppet: Getting it right from the start
Greenfield Puppet: Getting it right from the start
 
Puppet Camp Boston 2014: Greenfield Puppet: Getting it right from the start (...
Puppet Camp Boston 2014: Greenfield Puppet: Getting it right from the start (...Puppet Camp Boston 2014: Greenfield Puppet: Getting it right from the start (...
Puppet Camp Boston 2014: Greenfield Puppet: Getting it right from the start (...
 
Baking in the cloud with packer and puppet
Baking in the cloud with packer and puppetBaking in the cloud with packer and puppet
Baking in the cloud with packer and puppet
 
Harmonious Development: Via Vagrant and Puppet
Harmonious Development: Via Vagrant and PuppetHarmonious Development: Via Vagrant and Puppet
Harmonious Development: Via Vagrant and Puppet
 
Puppet and the HashiStack
Puppet and the HashiStackPuppet and the HashiStack
Puppet and the HashiStack
 
Amazon Web Services and Docker: from developing to production
Amazon Web Services and Docker: from developing to productionAmazon Web Services and Docker: from developing to production
Amazon Web Services and Docker: from developing to production
 
Having Fun with Play
Having Fun with PlayHaving Fun with Play
Having Fun with Play
 
Puppet at Opera Sofware - PuppetCamp Oslo 2013
Puppet at Opera Sofware - PuppetCamp Oslo 2013Puppet at Opera Sofware - PuppetCamp Oslo 2013
Puppet at Opera Sofware - PuppetCamp Oslo 2013
 

Plus de Puppet

Puppet camp2021 testing modules and controlrepo
Puppet camp2021 testing modules and controlrepoPuppet camp2021 testing modules and controlrepo
Puppet camp2021 testing modules and controlrepoPuppet
 
Puppetcamp r10kyaml
Puppetcamp r10kyamlPuppetcamp r10kyaml
Puppetcamp r10kyamlPuppet
 
2021 04-15 operational verification (with notes)
2021 04-15 operational verification (with notes)2021 04-15 operational verification (with notes)
2021 04-15 operational verification (with notes)Puppet
 
Puppet camp vscode
Puppet camp vscodePuppet camp vscode
Puppet camp vscodePuppet
 
Modules of the twenties
Modules of the twentiesModules of the twenties
Modules of the twentiesPuppet
 
Applying Roles and Profiles method to compliance code
Applying Roles and Profiles method to compliance codeApplying Roles and Profiles method to compliance code
Applying Roles and Profiles method to compliance codePuppet
 
KGI compliance as-code approach
KGI compliance as-code approachKGI compliance as-code approach
KGI compliance as-code approachPuppet
 
Enforce compliance policy with model-driven automation
Enforce compliance policy with model-driven automationEnforce compliance policy with model-driven automation
Enforce compliance policy with model-driven automationPuppet
 
Keynote: Puppet camp compliance
Keynote: Puppet camp complianceKeynote: Puppet camp compliance
Keynote: Puppet camp compliancePuppet
 
Automating it management with Puppet + ServiceNow
Automating it management with Puppet + ServiceNowAutomating it management with Puppet + ServiceNow
Automating it management with Puppet + ServiceNowPuppet
 
Puppet: The best way to harden Windows
Puppet: The best way to harden WindowsPuppet: The best way to harden Windows
Puppet: The best way to harden WindowsPuppet
 
Simplified Patch Management with Puppet - Oct. 2020
Simplified Patch Management with Puppet - Oct. 2020Simplified Patch Management with Puppet - Oct. 2020
Simplified Patch Management with Puppet - Oct. 2020Puppet
 
Accelerating azure adoption with puppet
Accelerating azure adoption with puppetAccelerating azure adoption with puppet
Accelerating azure adoption with puppetPuppet
 
Puppet catalog Diff; Raphael Pinson
Puppet catalog Diff; Raphael PinsonPuppet catalog Diff; Raphael Pinson
Puppet catalog Diff; Raphael PinsonPuppet
 
ServiceNow and Puppet- better together, Kevin Reeuwijk
ServiceNow and Puppet- better together, Kevin ReeuwijkServiceNow and Puppet- better together, Kevin Reeuwijk
ServiceNow and Puppet- better together, Kevin ReeuwijkPuppet
 
Take control of your dev ops dumping ground
Take control of your  dev ops dumping groundTake control of your  dev ops dumping ground
Take control of your dev ops dumping groundPuppet
 
100% Puppet Cloud Deployment of Legacy Software
100% Puppet Cloud Deployment of Legacy Software100% Puppet Cloud Deployment of Legacy Software
100% Puppet Cloud Deployment of Legacy SoftwarePuppet
 
Puppet User Group
Puppet User GroupPuppet User Group
Puppet User GroupPuppet
 
Continuous Compliance and DevSecOps
Continuous Compliance and DevSecOpsContinuous Compliance and DevSecOps
Continuous Compliance and DevSecOpsPuppet
 
The Dynamic Duo of Puppet and Vault tame SSL Certificates, Nick Maludy
The Dynamic Duo of Puppet and Vault tame SSL Certificates, Nick MaludyThe Dynamic Duo of Puppet and Vault tame SSL Certificates, Nick Maludy
The Dynamic Duo of Puppet and Vault tame SSL Certificates, Nick MaludyPuppet
 

Plus de Puppet (20)

Puppet camp2021 testing modules and controlrepo
Puppet camp2021 testing modules and controlrepoPuppet camp2021 testing modules and controlrepo
Puppet camp2021 testing modules and controlrepo
 
Puppetcamp r10kyaml
Puppetcamp r10kyamlPuppetcamp r10kyaml
Puppetcamp r10kyaml
 
2021 04-15 operational verification (with notes)
2021 04-15 operational verification (with notes)2021 04-15 operational verification (with notes)
2021 04-15 operational verification (with notes)
 
Puppet camp vscode
Puppet camp vscodePuppet camp vscode
Puppet camp vscode
 
Modules of the twenties
Modules of the twentiesModules of the twenties
Modules of the twenties
 
Applying Roles and Profiles method to compliance code
Applying Roles and Profiles method to compliance codeApplying Roles and Profiles method to compliance code
Applying Roles and Profiles method to compliance code
 
KGI compliance as-code approach
KGI compliance as-code approachKGI compliance as-code approach
KGI compliance as-code approach
 
Enforce compliance policy with model-driven automation
Enforce compliance policy with model-driven automationEnforce compliance policy with model-driven automation
Enforce compliance policy with model-driven automation
 
Keynote: Puppet camp compliance
Keynote: Puppet camp complianceKeynote: Puppet camp compliance
Keynote: Puppet camp compliance
 
Automating it management with Puppet + ServiceNow
Automating it management with Puppet + ServiceNowAutomating it management with Puppet + ServiceNow
Automating it management with Puppet + ServiceNow
 
Puppet: The best way to harden Windows
Puppet: The best way to harden WindowsPuppet: The best way to harden Windows
Puppet: The best way to harden Windows
 
Simplified Patch Management with Puppet - Oct. 2020
Simplified Patch Management with Puppet - Oct. 2020Simplified Patch Management with Puppet - Oct. 2020
Simplified Patch Management with Puppet - Oct. 2020
 
Accelerating azure adoption with puppet
Accelerating azure adoption with puppetAccelerating azure adoption with puppet
Accelerating azure adoption with puppet
 
Puppet catalog Diff; Raphael Pinson
Puppet catalog Diff; Raphael PinsonPuppet catalog Diff; Raphael Pinson
Puppet catalog Diff; Raphael Pinson
 
ServiceNow and Puppet- better together, Kevin Reeuwijk
ServiceNow and Puppet- better together, Kevin ReeuwijkServiceNow and Puppet- better together, Kevin Reeuwijk
ServiceNow and Puppet- better together, Kevin Reeuwijk
 
Take control of your dev ops dumping ground
Take control of your  dev ops dumping groundTake control of your  dev ops dumping ground
Take control of your dev ops dumping ground
 
100% Puppet Cloud Deployment of Legacy Software
100% Puppet Cloud Deployment of Legacy Software100% Puppet Cloud Deployment of Legacy Software
100% Puppet Cloud Deployment of Legacy Software
 
Puppet User Group
Puppet User GroupPuppet User Group
Puppet User Group
 
Continuous Compliance and DevSecOps
Continuous Compliance and DevSecOpsContinuous Compliance and DevSecOps
Continuous Compliance and DevSecOps
 
The Dynamic Duo of Puppet and Vault tame SSL Certificates, Nick Maludy
The Dynamic Duo of Puppet and Vault tame SSL Certificates, Nick MaludyThe Dynamic Duo of Puppet and Vault tame SSL Certificates, Nick Maludy
The Dynamic Duo of Puppet and Vault tame SSL Certificates, Nick Maludy
 

Dernier

Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 

Dernier (20)

Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 

Puppet at Pinterest

  • 1. Ryan Park / rpark@pinterest.com Slide Title Download slides and code samples at: https://github.com/pinterest/puppetconf
  • 2. Ryan Park / rpark@pinterest.com
  • 3. Ryan Park / rpark@pinterest.com Web Application Servers Internal Web Services Memcache MySQL Redis
  • 4. Ryan Park / rpark@pinterest.com Before Puppet ‣ 150 virtual servers: web app, MySQL, Memcache, Membase, Redis, Elastic Search... ‣ 12 Amazon Machine Images ‣ cut -f 1 ~/.ssh/known_hosts
  • 5. Ryan Park / rpark@pinterest.com Puppet Dashboard ‣ The “source of truth” about what’s running in our infrastructure ‣ Alternatives we considered ‣ Puppet manifests: only useful in Puppet ‣ LDAP: difficult to set up ‣ Foreman: too much for our needs
  • 6.
  • 7.
  • 8. Ryan Park / rpark@pinterest.com Puppet Dashboard ‣ Problem: Some dependencies are configured in Puppet Dashboard, others in Puppet manifests ‣ Solution: Define your dependencies in Puppet manifests when possible
  • 9. Ryan Park / rpark@pinterest.com Puppet Dashboard ‣ Node Groups are useful… ‣ …but more useful when you can use the data to power other systems. ‣ ...and even more useful when you combine Puppet Dashboard data with storedconfigs.
  • 10. Ryan Park / rpark@pinterest.com REST API [ryan@mac:~]$ curl https://puppet-dashboard/api/ { "nodes": "https://puppet-dashboard/api/node", "node_classes": "https://puppet-dashboard/api/class", "node_groups": "https://puppet-dashboard/api/group" } Self-documenting and nicely formatted
  • 11. Ryan Park / rpark@pinterest.com [ryan@mac:~]$ curl https://puppet-dashboard/api/group/ [ { "name": "datalayer", "url": "https://puppet-dashboard/api/group/datalayer" }, { "name": "follower", "url": "https://puppet-dashboard/api/group/follower" }, { "name": "mysql", "url": "https://puppet-dashboard/api/group/mysql" }, ... ]
  • 12. Ryan Park / rpark@pinterest.com Node Group API
  • 13. Ryan Park / rpark@pinterest.com Node Group API
  • 14. Ryan Park / rpark@pinterest.com Node Group API [ryan@mac:~]$ curl https://puppet-dashboard/api/group/follower_redis { "nodes": ..., "node_classes": ..., "parameters": ..., "ancestors": ..., "descendants": ... }
  • 15. "nodes": [ { "name": "followerredis001a", "href": "https://puppet-dashboard/api/node/followerredis001a", "source": { "type": "node_group", "name": "follower_redis", "href": "https://puppet-dashboard/api/group/follower_redis" } }, { "name": "followerredis001b", "href": "https://puppet-dashboard/api/node/followerredis001b", "source": { "type": "node_group", "name": "follower_redis", "href": "https://puppet-dashboard/api/group/follower_redis" } }, ]
  • 16. "node_classes": [ { "name": "redis", "href": "https://puppet-dashboard/api/class/redis", "source": { "type": "node_group", "name": "redis", "href": "https://puppet-dashboard/api/group/redis" } }, { "name": "redis::backup", "href": "https://puppet-dashboard/api/class/redis::backup", "source": { "type": "node_group", "name": "follower_redis", "href": "https://puppet-dashboard/api/group/follower_redis" } } ]
  • 17. "parameters": { "swapfile_size": { "key": "swapfile_size", "value": "10240", "source": { "type": "node_group", "name": "follower_redis", "href": "https://puppet-dashboard/api/group/follower_redis" } } }
  • 18. Ryan Park / rpark@pinterest.com Node API
  • 19. Ryan Park / rpark@pinterest.com Node API [ryan@mac:~]$ curl https://puppet-dashboard/api/node/followerredis001a { "status": "unchanged", "node_groups": ..., "node_classes": ..., "facts": ..., "parameters": ... }
  • 20. "facts": { "ipaddress": "10.131.60.134", "operatingsystem": "Ubuntu", "kernelversion": "2.6.38", "ec2_instance_id": "i-17500aaf", "ec2_instance_type": "m2.2xlarge", "ec2_placement_availability_zone": "us-east-1a" }, "parameters": { "swapfile_size": { "key": "swapfile_size", "value": "10240", "source": { "type": "node_group", "name": "follower_redis", "href": "https://puppet-dashboard/api/group/follower_redis" } } }
  • 21. Ryan Park / rpark@pinterest.com Sample API Client [ryan@mac:~]$ cat puppet_to_hosts.py import json import urllib2 def download_and_decode(url): request = urllib2.Request(url) response = urllib2.urlopen(request) return json.loads(response.read()) def main(): data = download_and_decode("http://puppet-dashboard/api/node/") for node in data['nodes']: if node.has_key('ipaddress') and node['ipaddress']: print node['ipaddress'] + " " + node['name'] if __name__ == "__main__": main()
  • 22. Ryan Park / rpark@pinterest.com Sample API Client [ryan@mac:~]$ python puppet_to_hosts.py 10.150.39.222 azkaban001 10.169.164.132 datalayer001 10.39.63.178 datalayer002 10.97.34.202 datalayer003 10.112.144.31 datalayer004 10.49.10.163 followerredis001a 10.18.185.220 followerredis001b
  • 23. Ryan Park / rpark@pinterest.com Our API Clients ‣ Generate /etc/hosts file ‣ Generate Monit configuration files ‣ Push hostnames to Amazon Route 53 DNS service ‣ Remove SSL certificates (puppetca --clean) for nodes that have been deleted from Puppet Dashboard
  • 24. Ryan Park / rpark@pinterest.com Our API Clients ‣ Source code deploy tools ‣ Monitoring dashboards ‣ Metrics dashboards
  • 25. Ryan Park / rpark@pinterest.com Puppet and Amazon EC2
  • 26. Ryan Park / rpark@pinterest.com Bootstrapping EC2 ‣ One custom image for all our instances ‣ Start with a basic Ubuntu AMI. ‣ Add packages facter, puppet, and ec2-api-tools. ‣ Modify /etc/rc.local to run Puppet when the instance launches.
  • 27. Ryan Park / rpark@pinterest.com We Cheat ‣ Problem: Using Puppet to install all our dependencies is too slow—it would take 20 minutes to launch an instance. ‣ Solution: We pre-install about 60 Debian packages and 60 Python packages.
  • 28. Ryan Park / rpark@pinterest.com EC2 Hostnames ‣ Problem: EC2 instance hostnames look like “ip-10-113-111-43.ec2.internal.” ‣ Solution: Set the hostname when booting the instance.
  • 29. Ryan Park / rpark@pinterest.com /etc/rc.local [ryan@followerredis001a:~]$ cat /etc/rc.local #!/bin/bash # Use ec2-api-tools to determine our instance name. # /etc/aws/cert.pem and /etc/aws/pk.pem must be present on the AMI, # along with the Debian packages ec2-api-tools and facter. export EC2_CERT=/etc/aws/cert.pem export EC2_PRIVATE_KEY=/etc/aws/pk.pem INSTANCE_ID=`facter ec2_instance_id` INSTANCE_NAME=`ec2-describe-tags --filter "key=Name" --filter "resource-type=instance" --filter "resource-id=$INSTANCE_ID" | sed 's/.*t//g'`
  • 30. # Set the hostname to $INSTANCE_NAME.example.com hostname $INSTANCE_NAME echo $INSTANCE_NAME > /etc/hostname sed -i "s/^domain .*$/domain example.com/g" /etc/resolv.conf sed -i "s/^search .*$/search example.com/g" /etc/resolv.conf IP_ADDRESS=`facter ipaddress_eth0` echo "# Additional entries added by bootstrap script" >> /etc/hosts echo "$IP_ADDRESS $INSTANCE_NAME.example.com $INSTANCE_NAME" >> /etc/hosts # Puppet will configure this instance based on the classes in the # Puppet Dashboard. puppet agent --onetime
  • 31. Ryan Park / rpark@pinterest.com EC2 Auto Scaling Busy Provisioned 80 60 40 20 0 5AM 12PM 7PM 2AM
  • 32. Ryan Park / rpark@pinterest.com EC2 Auto Scaling Busy Provisioned 80 60 40 20 0 5AM 12PM 7PM 2AM
  • 33. Ryan Park / rpark@pinterest.com EC2 Auto Scaling ‣ Problem: When using Puppet Dashboard as an external node classifier, every host must be declared explicitly in the Puppet Dashboard database. ‣ Solution: When a new instance starts, have it register itself in the Puppet Dashboard using our REST API.
  • 34. Ryan Park / rpark@pinterest.com EC2 Auto Scaling ‣ A POST to /api/provision/<node_group> adds a node to the Dashboard database and returns the hostname. [root@ip-10-88-155-31:~]# curl -X POST https://puppet-dashboard/api/provision/datalayer datalayer005 ‣ This endpoint returns the hostname as a string, not JSON.
  • 35. Ryan Park / rpark@pinterest.com EC2 Auto Scaling: /etc/rc.local # If there's no hostname, there may be a node group name in the # EC2 user-data string. Use the Puppet Dashboard API to request # a hostname in that node group. if [ -z "$INSTANCE_NAME" ]; then FILENAME="/var/lib/cloud/instances/$INSTANCE_ID/user-data.txt" if [ -f "$FILENAME" ]; then NODE_GROUP=`cat $FILENAME` if [ ! -z "$NODE_GROUP" ]; then INSTANCE_NAME=`curl -X POST https://puppet-dashboard/api/provision/$NODE_GROUP` fi fi fi
  • 36. Ryan Park / rpark@pinterest.com After Puppet ‣ Hundreds of virtual servers in 60 host groups ‣ 1 Amazon Machine Image ‣ Dozens of scripts pull data from Puppet Dashboard’s database
  • 37. Ryan Park / rpark@pinterest.com We’re Hiring! http://pinterest.com/about/careers
  • 38. Ryan Park / rpark@pinterest.com Contact rpark@pinterest.com ryanpark @StanfordRyan Download slides and code samples at: https://github.com/pinterest/puppetconf