Cloudstack talk

1,130 views
1,032 views

Published on

0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,130
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
43
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide

Cloudstack talk

  1. 1. Integrating CloudStack with PuppetSaturday, December 1, 12
  2. 2. About me: Dan Bode Integration Specialist at PuppetLabs @bodepd bodepd <on> freenodeSaturday, December 1, 12
  3. 3. Who is this talk for? current CloudStack Users Puppet beginnersSaturday, December 1, 12
  4. 4. It will cover why integrate? explanation of Puppet’s architecture as it applies to integration using Puppet to model VM instancesSaturday, December 1, 12
  5. 5. Why Integrate?Saturday, December 1, 12
  6. 6. Why integrate? CloudStack provides an API for provisioning virtual machines deployVirtualMachine Self Service API VM1Saturday, December 1, 12
  7. 7. Why integrate? Puppet converts freshly provisioned VMs into functional applications Self Service APi Make me an VM1 apache server Here are the instructions for becoming an Puppet apache server MasterSaturday, December 1, 12
  8. 8. Why integrate? Combined, they create fully automated application stacks. deploy me a DB, then 2 apache servers Self Service APi DB1 Apache1 Apache2Saturday, December 1, 12
  9. 9. Understanding PuppetSaturday, December 1, 12
  10. 10. 2 run modes puppet apply - all content is stored on the individual nodes. commonly used for testing (or for scale) client/server - content is served from a central master (this is what we will be talking about)Saturday, December 1, 12
  11. 11. A Puppet client/server run Classifier Modules Master Facts Catalog VM1Saturday, December 1, 12
  12. 12. Facter returns system specific information Classifier Modules Master Facts Catalog AgentSaturday, December 1, 12
  13. 13. Facter to see a system’s facts, run $ facter architecture => x86_64 domain => local facterversion => 2.0.0 fqdn => DansLapTop.local hardwareisa => i386 hardwaremodel => x86_64 id => danbodeSaturday, December 1, 12
  14. 14. Facter Nodes submit their facts as a part of the request for catalog. Available as top scope variables from manifests ie : $::fact_name Creating custom facts is easy.Saturday, December 1, 12
  15. 15. A Puppet client/server run Modules Classifier Master Facts Catalog VM1Saturday, December 1, 12
  16. 16. Modules Sharable content composed of classes and defined resource types (configuration interfaces).Saturday, December 1, 12
  17. 17. Module Forge http://forge.puppetlabs.com/ http://forge.puppetlabs.com/puppetlabs/apacheSaturday, December 1, 12
  18. 18. Classes/defines compose resourcesSaturday, December 1, 12
  19. 19. Resources Describe the configuration state of individual system elements. user { ‘dan’: ensure => present, shell => ‘/bin/bash’, }Saturday, December 1, 12
  20. 20. Resources Describe the configuration state of individual system elements. user { ‘dan’: # a user named dan ensure => present, # should exist shell => ‘/bin/bash’, # with this shell }Saturday, December 1, 12
  21. 21. Resources package { ‘apache2’: # a package named apache2 ensure => present, # should be installed }Saturday, December 1, 12
  22. 22. Puppet DSL and resourcesSaturday, December 1, 12
  23. 23. Puppet DSL and Resources The Puppet DSL can be used to compose collections of resources into classes or defined resources.Saturday, December 1, 12
  24. 24. Example apache class class apache { package { ‘apache2’: ensure => present, } file { ‘/etc/apache2/apache2.conf’: content => template(‘apache2/apache2.erb’), require => Package[‘apache2’], } service { ‘apache2’: ensure => running subscribe => File[‘/etc/apache2/apache2.conf’] } }Saturday, December 1, 12
  25. 25. A Puppet client/server run Classifier Modules Master Facts Catalog VM1Saturday, December 1, 12
  26. 26. Classification Process that determines how Puppet maps a role to a specific instance.Saturday, December 1, 12
  27. 27. Site manifest Master /etc/puppet/manifest/site.pp The master utilizes code from its site manifest to figure out how to assign a role to a node.Saturday, December 1, 12
  28. 28. Site manifest Node blocks map a host’s certname to content from a module node /^my_node/ { include apache }Saturday, December 1, 12
  29. 29. Determine role based on facts deploy me an apache server Self Service APi Apache1Saturday, December 1, 12
  30. 30. Determine role based on facts ‘deployVirtualMachine’ -> userdata -> facts node default { if $::role == ‘apache’ { include apache } else { fail(“Undefine role: ${role}”) } }Saturday, December 1, 12
  31. 31. Decouple role assignment from provisioning After provisioning is completed, ssh into a machine, set a custom fact (using facts.d), and trigger a puppet run. pros - you can easily execute a script to install and bootstrap puppet cons - extra stepSaturday, December 1, 12
  32. 32. facts.d facts.d comes with stdlib (http://forge.puppetlabs.com/puppetlabs/stdlib) it converts any ‘key=value’ pairs listed in /etc/ facts.d/*.txt into factsSaturday, December 1, 12
  33. 33. ENC ENC Master The master can call out to arbitrary executables to figure out how a node should be classified.Saturday, December 1, 12
  34. 34. ENC You can set the ‘group’ attribute with classification information when instances are created. The ENC can then query the ‘group’ attribute from the VM instance that needs to be classified.Saturday, December 1, 12
  35. 35. A Puppet client/server run Classifier Modules Master Facts Catalog VM1Saturday, December 1, 12
  36. 36. Catalog Collection of resources that describe how a node can achieve a specified configuration.Saturday, December 1, 12
  37. 37. Catalog Resources Catalog Package Package File File User User ServiceDependencies ServiceSaturday, December 1, 12
  38. 38. VM provisioning with Puppet (experimental! use cases appreciated)Saturday, December 1, 12
  39. 39. Share Application Stacks as text class my_app_stack { cloudstack_instance { foo4: ensure => present, group => role=db, } cloudstack_instance { foo3: ensure => present, group => role=apache, } }Saturday, December 1, 12
  40. 40. Use resource defaults for common settings Cloudstack_instance { image => CentOS 5.6 key+pass, flavor => Small Instance, zone => ACS-FMT-001, network => puppetlabs-network, keypair => dans_keypair4, } cloudstack_instance { foo4: ensure => $::ensure, group => role=db, } cloudstack_instance { foo3: ensure => $::ensure, group => role=apache, }Saturday, December 1, 12

×