Friday, August 23, 13
DataDrive
nInfrastructur
e
Friday, August 23, 13
Friday, August 23, 13
?
Friday, August 23, 13
?
http://git.io/UmUdKA
Friday, August 23, 13
Let me
Tell you
a story
Friday, August 23, 13
What is a
Cloud
Friday, August 23, 13
I don’t have to think about IT
With the Cloud...
Friday, August 23, 13
Friday, August 23, 13
aaSPlatform
Software
Infrastruct
ure
Friday, August 23, 13
Friday, August 23, 13
Friday, August 23, 13
Where is
our cloud?
Friday, August 23, 13
Friday, August 23, 13
UtopiaFriday, August 23, 13
James
Fryman
Friday, August 23, 13
Friday, August 23, 13
AutomationsJunkie
Friday, August 23, 13
Are you
Crazy?
Friday, August 23, 13
Goals?Data?
What
Friday, August 23, 13
Goals?Data?
What
Friday, August 23, 13
Goals?Data?
What
Friday, August 23, 13
Machine
Parsable
Friday, August 23, 13
There is SystemOne
Friday, August 23, 13
Feedback
PuppetDB
Provisioning
Configuring
Destroying
gPanel
Friday, August 23, 13
Parts
of the
System
Friday, August 23, 13
provisioner
Friday, August 23, 13
Home
Grown
Friday, August 23, 13
Home Grown
Friday, August 23, 13
controller
Friday, August 23, 13
Lots O’
Models
Friday, August 23, 13
file { '/etc/facter/facts.d/quagga_manage_service':
ensure => present,
replace => false,
}
 
if $::quagga_manage_service {...
orchestrator
Friday, August 23, 13
Chat
Ops
Friday, August 23, 13
Chat
Ops
Friday, August 23, 13
Feedback
of the
System
Friday, August 23, 13
Metrics
&Monitoring
Friday, August 23, 13
begin
JSON.parse(RestClient.get(url)).each do |cache|
data["#{cache['target']}"] = 0
count = 0
cache["datapoints"].each do...
begin
JSON.parse(RestClient.get(url)).each do |cache|
data["#{cache['target']}"] = 0
count = 0
cache["datapoints"].each do...
event
Friday, August 23, 13
event
log
Friday, August 23, 13
event
alertlog
Friday, August 23, 13
event
alertlog error
Friday, August 23, 13
Must self-correct
Friday, August 23, 13
Feedback
PuppetDB
Provisioning
Configuring
Destroying
gPanel
Friday, August 23, 13
Friday, August 23, 13
Deployable
using text files
Friday, August 23, 13
Modularity
Friday, August 23, 13
haproxy::proxy { $es_proxy_name:
proxy => 'listen',
mode => 'http',
ip => $::ipaddress_lo,
port => '9200',
config => {
bal...
haproxy::proxy { $es_proxy_name:
proxy => 'listen',
mode => 'http',
ip => $::ipaddress_lo,
port => '9200',
config => {
bal...
haproxy::proxy::member { $es_proxy_name:
hostname => $::ec2_local_ipv4,
port => '9200',
param => [
'weight 1',
'maxconn 10...
collectd::plugin { [
'cpu',
'load',
'memory',
'swap',
'irq',
'exec',
'entropy',
]:
}
 
collectd::plugin { [
'df',
'interfa...
Level 4:
Templates
Level 5:
Data Driven
Friday, August 23, 13
Self
Authoritati
ve
Friday, August 23, 13
def self.collect_resources(resource)
query = [
"and",
["=", "type", "File"],
["=", "exported", true],
["=", "tag", "nagios...
def self.collect_resources(resource)
query = [
"and",
["=", "type", "File"],
["=", "exported", true],
["=", "tag", "nagios...
# Seed the initial file with false, and enable
# on next run with gh-nagios enable_pager <hostname>
file { '/etc/facter/fa...
@@file { "/etc/nagios/objects/${type}.d/${filename}.cfg":
content => template('nagios/etc/nagios/object.erb'),
mode => '04...
Tips
Friday, August 23, 13
Refactoring
Friday, August 23, 13
Refactoring
Friday, August 23, 13
least to most
specific
Friday, August 23, 13
frymanet.com
mysqlnginx rails
rubycommon admin
package repos
Friday, August 23, 13
graduate to
params
Friday, August 23, 13
class ntp::params {
  $defaults = {
package => {
version => ‘latest’,
},
config => {
servers => [‘pool.ntp.org’],
},
}
}
F...
externalize
Friday, August 23, 13
class ntp::params {
  $defaults = {
package => {
version =>
hiera(‘ntp_package_version’),
},
config => {
servers => hiera(...
CloudFormation
Friday, August 23, 13
CloudFormation
Friday, August 23, 13
"Resources": {
"RendererServerGroup": {
"Type": "AWS::AutoScaling::AutoScalingGroup",
"Properties": {
"AvailabilityZones":...
Autoloading
Friday, August 23, 13
# autoloader.pp
class nagios::autoload_helpers {
$helpers = get_nagios_helpers()
case $::puppetversion {
/^3/: { include $...
# autoloader.pp
class nagios::autoload_helpers {
$helpers = get_nagios_helpers()
case $::puppetversion {
/^3/: { include $...
module Puppet::Parser::Functions
newfunction(:get_nagios_helpers,
:type => :rvalue,
:doc => "Grab all modules that have na...
Modeling
Friday, August 23, 13
Be Dynamic
Friday, August 23, 13
Be Dynamic
Friday, August 23, 13
<%- if @comment -%>
### <%= @comment %>
<%- end -%>
<%= @type %> <% if @label %><%=
@label %><% end %> {
<%- @config.sort....
Fencing Resources
Friday, August 23, 13
# Seed the initial file with false, and enable
# on next run with gh-nagios enable_pager <hostname>
file { '/etc/facter/fa...
if $::enable_pager {
@@file { "/etc/nagios/objects/${type}.d/${filename}.cfg":
content => template('nagios/etc/nagios/obje...
Buy it?
Friday, August 23, 13
Buy it?
Friday, August 23, 13
It’s About
Friday, August 23, 13
Missing?
What’s
Friday, August 23, 13
Language
Friday, August 23, 13
Predictive
Analysis
Friday, August 23, 13
Coming
Home
Friday, August 23, 13
Goals?Data?
What
Friday, August 23, 13
Systems
Thinking
Recap
Friday, August 23, 13
There is SystemOne
Machine
Parsable
Must be
a
Know
n
Quantity
Self
Authoritati
ve
Must self-correctFriday, August 23, 13
Friday, August 23, 13
jfryman
fryman@github.com
Friday, August 23, 13
jfryman
fryman@github.com
Friday, August 23, 13
what’s next?
Friday, August 23, 13
what’s next?
Friday, August 23, 13
Upcoming SlideShare
Loading in …5
×

Building Data-Driven Infrastructure with Puppet - PuppetConf 2013

3,947 views
3,837 views

Published on

"Building Data-Driven Infrastructure with Puppet" by James Fryman, Operations Hacker, GitHub, Inc.

Presentation Overview: As your Puppet Infrastructure grows, so does the complexity of the Puppet codebase. The complexity of the codebase often creates a scenario where it becomes more time consuming to modify/add to the codebase. Likewise, any new addition or node still may require modifications to the Puppet database, which could include the management of many edge cases. Fortunately, the software industry has been working on developing techniques with code abstraction, refactoring, and software maturity. This talk will focus on how to write scalable modules within Puppet to be used to create Data Driven Infrastructures. In addition, this talk will demonstrate how to structure process/procedure/code to quickly and rapidly scale operations with minimal modifications to Puppet code.

Speaker Bio: James Fryman, Operations Hacker, GitHub, Inc. James Fryman is a Technologist who has been working on spreading the good word of technology via the greatest mechanism known to man: the beer fueled rant. James has been working to automate software and infrastructure for the last 10 years, and has learned quite a bit about Security, Architecture, Scaling, and Development as a result. James currently works for GitHub as an Operations Hacker.

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
3,947
On SlideShare
0
From Embeds
0
Number of Embeds
5
Actions
Shares
0
Downloads
25
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Building Data-Driven Infrastructure with Puppet - PuppetConf 2013

  1. 1. Friday, August 23, 13
  2. 2. DataDrive nInfrastructur e Friday, August 23, 13
  3. 3. Friday, August 23, 13
  4. 4. ? Friday, August 23, 13
  5. 5. ? http://git.io/UmUdKA Friday, August 23, 13
  6. 6. Let me Tell you a story Friday, August 23, 13
  7. 7. What is a Cloud Friday, August 23, 13
  8. 8. I don’t have to think about IT With the Cloud... Friday, August 23, 13
  9. 9. Friday, August 23, 13
  10. 10. aaSPlatform Software Infrastruct ure Friday, August 23, 13
  11. 11. Friday, August 23, 13
  12. 12. Friday, August 23, 13
  13. 13. Where is our cloud? Friday, August 23, 13
  14. 14. Friday, August 23, 13
  15. 15. UtopiaFriday, August 23, 13
  16. 16. James Fryman Friday, August 23, 13
  17. 17. Friday, August 23, 13
  18. 18. AutomationsJunkie Friday, August 23, 13
  19. 19. Are you Crazy? Friday, August 23, 13
  20. 20. Goals?Data? What Friday, August 23, 13
  21. 21. Goals?Data? What Friday, August 23, 13
  22. 22. Goals?Data? What Friday, August 23, 13
  23. 23. Machine Parsable Friday, August 23, 13
  24. 24. There is SystemOne Friday, August 23, 13
  25. 25. Feedback PuppetDB Provisioning Configuring Destroying gPanel Friday, August 23, 13
  26. 26. Parts of the System Friday, August 23, 13
  27. 27. provisioner Friday, August 23, 13
  28. 28. Home Grown Friday, August 23, 13
  29. 29. Home Grown Friday, August 23, 13
  30. 30. controller Friday, August 23, 13
  31. 31. Lots O’ Models Friday, August 23, 13
  32. 32. file { '/etc/facter/facts.d/quagga_manage_service': ensure => present, replace => false, }   if $::quagga_manage_service { $service_state[ensure] = running $service_state[enable] = true } else { $service_state[ensure] = undef $service_state[enable] = undef }   service { 'quagga': ensure => $service_state[ensure], enable => $service_state[enable], } Friday, August 23, 13
  33. 33. orchestrator Friday, August 23, 13
  34. 34. Chat Ops Friday, August 23, 13
  35. 35. Chat Ops Friday, August 23, 13
  36. 36. Feedback of the System Friday, August 23, 13
  37. 37. Metrics &Monitoring Friday, August 23, 13
  38. 38. begin JSON.parse(RestClient.get(url)).each do |cache| data["#{cache['target']}"] = 0 count = 0 cache["datapoints"].each do |point| unless (point[0].nil?) data["#{cache['target']}"] += point[0] count += 1 end end data["#{cache['target']}"] /= count data["total"] += data["#{cache['target']}"] end rescue ZeroDivisionError => e puts "UNKNOWN metric not in graphite!" exit EXIT_UNKNOWN rescue => e puts e.message exit EXIT_CRITICAL end Friday, August 23, 13
  39. 39. begin JSON.parse(RestClient.get(url)).each do |cache| data["#{cache['target']}"] = 0 count = 0 cache["datapoints"].each do |point| unless (point[0].nil?) data["#{cache['target']}"] += point[0] count += 1 end end data["#{cache['target']}"] /= count data["total"] += data["#{cache['target']}"] end rescue ZeroDivisionError => e puts "UNKNOWN metric not in graphite!" exit EXIT_UNKNOWN rescue => e puts e.message exit EXIT_CRITICAL end Friday, August 23, 13
  40. 40. event Friday, August 23, 13
  41. 41. event log Friday, August 23, 13
  42. 42. event alertlog Friday, August 23, 13
  43. 43. event alertlog error Friday, August 23, 13
  44. 44. Must self-correct Friday, August 23, 13
  45. 45. Feedback PuppetDB Provisioning Configuring Destroying gPanel Friday, August 23, 13
  46. 46. Friday, August 23, 13
  47. 47. Deployable using text files Friday, August 23, 13
  48. 48. Modularity Friday, August 23, 13
  49. 49. haproxy::proxy { $es_proxy_name: proxy => 'listen', mode => 'http', ip => $::ipaddress_lo, port => '9200', config => { balance => 'roundrobin', }, } Friday, August 23, 13
  50. 50. haproxy::proxy { $es_proxy_name: proxy => 'listen', mode => 'http', ip => $::ipaddress_lo, port => '9200', config => { balance => 'roundrobin', }, } Friday, August 23, 13
  51. 51. haproxy::proxy::member { $es_proxy_name: hostname => $::ec2_local_ipv4, port => '9200', param => [ 'weight 1', 'maxconn 1000', 'check', ], } Friday, August 23, 13
  52. 52. collectd::plugin { [ 'cpu', 'load', 'memory', 'swap', 'irq', 'exec', 'entropy', ]: }   collectd::plugin { [ 'df', 'interface', 'protocols', 'disk', ]: config => true } Friday, August 23, 13
  53. 53. Level 4: Templates Level 5: Data Driven Friday, August 23, 13
  54. 54. Self Authoritati ve Friday, August 23, 13
  55. 55. def self.collect_resources(resource) query = [ "and", ["=", "type", "File"], ["=", "exported", true], ["=", "tag", "nagios::object::#{resource}"], ["=", ["node", "active"], true] ] self.search('/v2/resources', query.to_json) end Friday, August 23, 13
  56. 56. def self.collect_resources(resource) query = [ "and", ["=", "type", "File"], ["=", "exported", true], ["=", "tag", "nagios::object::#{resource}"], ["=", ["node", "active"], true] ] self.search('/v2/resources', query.to_json) end Friday, August 23, 13
  57. 57. # Seed the initial file with false, and enable # on next run with gh-nagios enable_pager <hostname> file { '/etc/facter/facts.d/enable_pager.txt': ensure => file, owner => 'root', group => 'root', mode => '0644', content => 'enable_pager=false', replace => false, } Friday, August 23, 13
  58. 58. @@file { "/etc/nagios/objects/${type}.d/${filename}.cfg": content => template('nagios/etc/nagios/object.erb'), mode => '0444', group => 'nagios', notify => Service['nagios'], } Friday, August 23, 13
  59. 59. Tips Friday, August 23, 13
  60. 60. Refactoring Friday, August 23, 13
  61. 61. Refactoring Friday, August 23, 13
  62. 62. least to most specific Friday, August 23, 13
  63. 63. frymanet.com mysqlnginx rails rubycommon admin package repos Friday, August 23, 13
  64. 64. graduate to params Friday, August 23, 13
  65. 65. class ntp::params {   $defaults = { package => { version => ‘latest’, }, config => { servers => [‘pool.ntp.org’], }, } } Friday, August 23, 13
  66. 66. externalize Friday, August 23, 13
  67. 67. class ntp::params {   $defaults = { package => { version => hiera(‘ntp_package_version’), }, config => { servers => hiera(‘ntp_servers’), }, } } Friday, August 23, 13
  68. 68. CloudFormation Friday, August 23, 13
  69. 69. CloudFormation Friday, August 23, 13
  70. 70. "Resources": { "RendererServerGroup": { "Type": "AWS::AutoScaling::AutoScalingGroup", "Properties": { "AvailabilityZones": { "Fn::GetAZs": "" }, "LaunchConfigurationName": { "Ref": "LaunchConfig" }, "MinSize": "2", "MaxSize": "16", "Tags": [ { "Key": "Environment", "Value": "Production", "PropagateAtLaunch": "true" }, { "Key": "Role", "Value": "renderer", "PropagateAtLaunch": "true" } ] } }, Friday, August 23, 13
  71. 71. Autoloading Friday, August 23, 13
  72. 72. # autoloader.pp class nagios::autoload_helpers { $helpers = get_nagios_helpers() case $::puppetversion { /^3/: { include $helpers } default: { nagios::autoload_helpers::import_shim { $helpers: } } } } Friday, August 23, 13
  73. 73. # autoloader.pp class nagios::autoload_helpers { $helpers = get_nagios_helpers() case $::puppetversion { /^3/: { include $helpers } default: { nagios::autoload_helpers::import_shim { $helpers: } } } } Friday, August 23, 13
  74. 74. module Puppet::Parser::Functions newfunction(:get_nagios_helpers, :type => :rvalue, :doc => "Grab all modules that have nagios helpers for import") do module_path = File.expand_path('..', Puppet::Module.find('nagios',compiler.environment.to_s).path) helpers = Dir["#{module_path}/**/nagios/helpers.pp"].map do |d| "#{d.split('/')[-4]}::nagios::helpers" done helpers end end Friday, August 23, 13
  75. 75. Modeling Friday, August 23, 13
  76. 76. Be Dynamic Friday, August 23, 13
  77. 77. Be Dynamic Friday, August 23, 13
  78. 78. <%- if @comment -%> ### <%= @comment %> <%- end -%> <%= @type %> <% if @label %><%= @label %><% end %> { <%- @config.sort.reverse.each do | key,value| -%> <%- if value.class == Array -%> <%- value.each do |element| - %> <%= key %>(<%= element %>); <%- end -%> <%- else -%> <%= key %>(<%= value %>); <%- end -%> <%- end -%> }; Friday, August 23, 13
  79. 79. Fencing Resources Friday, August 23, 13
  80. 80. # Seed the initial file with false, and enable # on next run with gh-nagios enable_pager <hostname> file { '/etc/facter/facts.d/enable_pager.txt': ensure => file, owner => 'root', group => 'root', mode => '0644', content => 'enable_pager=false', replace => false, } Friday, August 23, 13
  81. 81. if $::enable_pager { @@file { "/etc/nagios/objects/${type}.d/${filename}.cfg": content => template('nagios/etc/nagios/object.erb'), mode => '0444', group => 'nagios', notify => Service['nagios'], } } Friday, August 23, 13
  82. 82. Buy it? Friday, August 23, 13
  83. 83. Buy it? Friday, August 23, 13
  84. 84. It’s About Friday, August 23, 13
  85. 85. Missing? What’s Friday, August 23, 13
  86. 86. Language Friday, August 23, 13
  87. 87. Predictive Analysis Friday, August 23, 13
  88. 88. Coming Home Friday, August 23, 13
  89. 89. Goals?Data? What Friday, August 23, 13
  90. 90. Systems Thinking Recap Friday, August 23, 13
  91. 91. There is SystemOne Machine Parsable Must be a Know n Quantity Self Authoritati ve Must self-correctFriday, August 23, 13
  92. 92. Friday, August 23, 13
  93. 93. jfryman fryman@github.com Friday, August 23, 13
  94. 94. jfryman fryman@github.com Friday, August 23, 13
  95. 95. what’s next? Friday, August 23, 13
  96. 96. what’s next? Friday, August 23, 13

×