cloudstack talk

Download Cloudstack talk

Post on 08-May-2015

838 views

Category:

Documents

2 download

Embed Size (px)

TRANSCRIPT

  • 1.IntegratingCloudStackwith PuppetSaturday, December 1, 12

2. About me:Dan BodeIntegration Specialist at PuppetLabs@bodepdbodepd freenodeSaturday, December 1, 12 3. Who is this talk for? current CloudStack Users Puppet beginnersSaturday, December 1, 12 4. It will cover why integrate? explanation of Puppets architecture as it applies to integration using Puppet to model VM instancesSaturday, December 1, 12 5. Why Integrate?Saturday, December 1, 12 6. Why integrate? CloudStack provides an API for provisioning virtual machines deployVirtualMachineSelf Service API VM1Saturday, December 1, 12 7. Why integrate? Puppet converts freshly provisioned VMs into functional applicationsSelf Service APiMake me an VM1apache server Here are the instructions for becoming an Puppet apache server MasterSaturday, December 1, 12 8. Why integrate? Combined, they create fully automated application stacks.deploy me a DB,then 2 apache servers Self Service APi DB1Apache1 Apache2Saturday, December 1, 12 9. UnderstandingPuppetSaturday, December 1, 12 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. A Puppet client/server run ClassifierModulesMasterFactsCatalogVM1Saturday, December 1, 12 12. Facter returns system specific information ClassifierModulesMaster Facts CatalogAgentSaturday, December 1, 12 13. Facter to see a systems 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. FacterNodes submit their facts as a part of the requestfor catalog.Available as top scope variables from manifestsie : $::fact_nameCreating custom facts is easy.Saturday, December 1, 12 15. A Puppet client/server run Modules ClassifierMasterFacts CatalogVM1Saturday, December 1, 12 16. ModulesSharable content composed of classes and definedresource types (configuration interfaces).Saturday, December 1, 12 17. Module Forgehttp://forge.puppetlabs.com/http://forge.puppetlabs.com/puppetlabs/apacheSaturday, December 1, 12 18. Classes/defines compose resourcesSaturday, December 1, 12 19. ResourcesDescribe the conguration state of individual systemelements.user { dan:ensure => present,shell => /bin/bash,}Saturday, December 1, 12 20. ResourcesDescribe the conguration state of individual systemelements.user { dan: # a user named danensure => present,# should existshell => /bin/bash, # with this shell}Saturday, December 1, 12 21. Resourcespackage { apache2: # a package named apache2ensure => present, # should be installed}Saturday, December 1, 12 22. Puppet DSL and resourcesSaturday, December 1, 12 23. Puppet DSL and Resources The Puppet DSL can be used to compose collections of resources into classes or dened resources.Saturday, December 1, 12 24. Example apache class class apache {package { apache2:ensure => present,}le { /etc/apache2/apache2.conf:content => template(apache2/apache2.erb),require => Package[apache2],}service { apache2:ensure => runningsubscribe => File[/etc/apache2/apache2.conf] } }Saturday, December 1, 12 25. A Puppet client/server run Classifier ModulesMasterFactsCatalogVM1Saturday, December 1, 12 26. ClassificationProcess that determines how Puppet maps a roleto a specific instance.Saturday, December 1, 12 27. Site manifestMaster /etc/puppet/manifest/site.pp The master utilizes code from its site manifest to gure out how to assign a role to a node.Saturday, December 1, 12 28. Site manifestNode blocks map a hosts certname to content from amodule node /^my_node/ { include apache }Saturday, December 1, 12 29. Determine role based on factsdeploy me an apache server Self Service APiApache1Saturday, December 1, 12 30. Determine role based on factsdeployVirtualMachine -> userdata -> factsnode default {if $::role == apache {include apache} else {fail(Undene role: ${role})}}Saturday, December 1, 12 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. 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. ENCENC Master The master can call out to arbitrary executables to gure out how a node should be classied.Saturday, December 1, 12 34. ENCYou can set the group attribute with classicationinformation when instances are created.The ENC can then query the group attribute from theVM instance that needs to be classied.Saturday, December 1, 12 35. A Puppet client/server run ClassifierModulesMasterFacts CatalogVM1Saturday, December 1, 12 36. CatalogCollection of resources that describe how a node canachieve a specied conguration.Saturday, December 1, 12 37. Catalog ResourcesCatalogPackage Package File File User UserServiceDependencies ServiceSaturday, December 1, 12 38. VM provisioning with Puppet(experimental! use casesappreciated)Saturday, December 1, 12 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. 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