Puppet at GitHub (PuppetCamp Raleigh 2013)

Puppet at GitHub (PuppetCamp Raleigh 2013)

Cd839cc361ffa996be0cc8259f3d7555?s=128

Will Farrington

May 16, 2013
Tweet

Transcript

  1. 22.

    The State of Puppet at GitHub AN AVERAGE WEEK About

    50 Pull Requests and 25 Issues comprising 300 commits across 24 authors 
  2. 33.

     How GitHub Writes Puppet class redis::server( $data_dir = '/var/lib/redis',

    $manage_service = false, $package = 'redis-server' ) { validate_bool($manage_service) validate_absolute_path($data_dir) validate_re($package, '^redis2?-server$', "Redis::Server[${name}]: package must be either redis-server or redis2-server: $ {package}") }
  3. 35.

     How GitHub Writes Puppet define ruby::version( $env = {}

    ) { $default_environment = { 'CC' => 'clang', 'CFLAGS' => '-O2' } $ruby_build_environment = merge($default_environment, $env) exec { "install ruby version ${name}": environment => join_keys_to_values($ruby_build_environment, '=') } }
  4. 37.

     How GitHub Writes Puppet class redis::server( $data_dir = '/var/lib/redis'

    ) { if ! defined_with_params(User[redis], { ensure => 'present' }) { user { 'redis': ensure => 'present', group => 'redis' } } }
  5. 38.

     How GitHub Writes Puppet $latest_tcs_version = "${::ruby::root}/versions/1.9.3-p231-tcs-github-1.0.30" $tcs_alias =

    "${::ruby::root}/versions/1.9.3-p231-tcs-github" $desired_params = { 'ensure' => 'link', 'target' => $latest_tcs_version, 'force' => true } File <| title == $tcs_version |> { ensure => link, target => $latest_tcs_version, force => true } ensure_resource('file', $tcs_alias, $desired_params)
  6. 43.

    class github::role::redis($env, $private_ipv4) { validate_re($env, '^(vagrant|staging|production)$') validate_re($private_ipv4, '^\d+\.\d+\.\d+\.\d+$') $monitor =

    $env ? { 'production' => true, default => false } class { 'github::core': monitor => $monitor, private_address => $private_ipv4 ; 'redis::server': bind_address => $private_ipv4, monitor => $monitor ; } }  How GitHub Writes Puppet
  7. 45.

    class github::core($monitor) { include github::common_packages include github::staff class { 'github::ssh':

    monitor => $monitor ; 'github::ipv6': ensure => absent ; } }  How GitHub Writes Puppet
  8. 46.

    class github::ipv6($ensure = present) { if $::lsbdistcodename != 'squeeze' {

    file { '/etc/modprobe.d/ipv6': ensure => $ensure, mode => '0444', source => 'puppet:///modules/github//etc/modprobe.d/ipv6', } } else { $value = $ensure ? { present => 0, default => 1 } sysctl { 'net.ipv6.conf.all.disable_ipv6': value => $value, } } }  How GitHub Writes Puppet
  9. 48.

    class redis::server($bind_address, $data_dir, $monitor, $port) { redis::config { 'dir': value

    => $data_dir, require => File[$data_dir]; 'bind': value => $bind_address; 'port': value => $port; 'daemonize': value => 'yes'; } }  How GitHub Writes Puppet
  10. 49.

    define redis::config($value, $ensure = present) { validate_re($ensure, '^(present|absent)$') $changes =

    $ensure ? { present => "set ${name} ${value}", default => "rm ${name}" } augeas { "Set Redis config '${name}' to '${value}'": changes => $changes, context => '/files/etc/redis/redis.conf', lens => 'Redis.lns', incl => '/etc/redis/redis.conf', require => File['/etc/redis/redis.conf'] } }  How GitHub Writes Puppet
  11. 60.

    $ git commit -am "can't lint this" modules/github/manifests/role/redis.pp: syntax ok

    modules/github/manifests/role/redis.pp - WARNING: => is not properly aligned on line 118 1 errors found, aborting commit.  How GitHub Deploys Puppet
  12. 64.

    /puppet env worker #=> worker1.rs.github.com: production worker2.rs.github.com: production worker3.rs.github.com: production

    worker4.rs.github.com: production worker5.rs.github.com: production worker6.rs.github.com: production  How GitHub Deploys Puppet
  13. 75.

    You haven't run Boxen in over a week. =( We

    really recommend running Boxen regularly. It's way better that way! Do you want to run boxen now? (y/N) y # boxen Updating Boxen. ... The Future of Puppet at GitHub 