Upgrade to Pro — share decks privately, control downloads, hide ads and more …

PUP201: How To Use Puppet Like An Adult

PUP201: How To Use Puppet Like An Adult

Puppet is an immensely powerful tool for system administration, but with great power comes great responsibility, and it’s not always obvious how to structure your configurations. There are many different ways to accomplish similar goals, and this malleability has given rise to a plethora of different design and architecture principles - some of which are good, and many of which are bad.

In this talk, Ben and Dan will explain the guiding principles of responsible Puppet design and architecture, walking you through real-world examples in order to illustrate solid methodological approaches, and illuminate Puppet administrators of all skill levels. As an added bonus, we will also show you how Puppet can be integrated into automated deployment and continuous integration platforms - an increasingly important component of today’s development and operational landscape.

phrawzty

July 25, 2013
Tweet

More Decks by phrawzty

Other Decks in Technology

Transcript

  1. HIERA Lightweight Pluggable Hierarchical Database Many possible back-ends Standard in

    Puppet 3.0 $ v a r = l o o k u p ( ' s o m e t h i n g ' ) # u n s c o p e d ( c o m p l i c a t e d ) $ v a r = l o o k u p ( ' n a m e s p a c e : : s o m e t h i n g ' ) # s c o p e d ( k i t t e n s )
  2. PUPPETDB « High-performance storeconfigs » c l a s s

    s s h { @ @ s s h { $ h o s t n a m e : t y p e = > d s a , k e y = $ s s h d s a k e y } # D e c l a r e S s h k e y < < | | > > # C o l l e c t }
  3. MODULE TEMPLATE $ p u p p e t m

    o d u l e g e n e r a t e a u t h o r - m o d _ n a m e G e n e r a t i n g m o d u l e a t a u t h o r - m o d _ n a m e / a u t h o r - m o d _ n a m e a u t h o r - m o d _ n a m e / t e s t s a u t h o r - m o d _ n a m e / t e s t s / i n i t . p p a u t h o r - m o d _ n a m e / s p e c a u t h o r - m o d _ n a m e / s p e c / s p e c _ h e l p e r . r b a u t h o r - m o d _ n a m e / R E A D M E a u t h o r - m o d _ n a m e / M o d u l e f i l e a u t h o r - m o d _ n a m e / m a n i f e s t s a u t h o r - m o d _ n a m e / m a n i f e s t s / i n i t . p p
  4. CENTRALISED PARAMETERS p a r a m s . p

    p Basic set of sane platform defaults Highly portable
  5. PARAMETERISED CLASSES Similar to definitions c l a s s

    s o m e d a e m o n ( $ d i r , $ c o n f i g , $ e n s u r e = t r u e ) { f i l e { " $ { d i r } / c o n f i g " : c o n t e n t = > $ c o n f i g } s e r v i c e { ' s o m e d a e m o n ' : e n s u r e = > $ e n s u r e } }
  6. PARSER VALIDATION $ p u p p e t p

    a r s e r v a l i d a t e m a n i f e s t . p p e r r : C o u l d n o t p a r s e f o r e n v i r o n m e n t p r o d u c t i o n : S y n t a x e r r o r a t ' b l a h ' a t m a n i f e s t . p p : 8
  7. LINTING $ p u p p e t - l

    i n t m a n i f e s t . p p W A R N I N G : c l a s s n o t d o c u m e n t e d o n l i n e 8 W A R N I N G : l i n e h a s m o r e t h a n 8 0 c h a r a c t e r s o n l i n e 4 4 W A R N I N G : s t r i n g c o n t a i n i n g o n l y a v a r i a b l e o n l i n e 5 4 W A R N I N G : t o p - s c o p e v a r i a b l e b e i n g u s e d w i t h o u t a n e x p l i c i t n a m e s p a c e o n l i n e 5 4
  8. PUPPET-CONCAT Dynamically build text files c o n c a

    t { ' c o n f i g _ f i l e ' : } c o n c a t : : f r a g m e n t { ' h e a d e r ' : t a r g e t = > ' c o n f i g _ f i l e ' , s o u r c e = > ' p u p p e t : / / / m o d u l e s / f o o / h e a d e r . s n i p p e t ' , o r d e r = > 1 0 } c o n c a t : : f r a g m e n t { ' b o d y ' : t a r g e t = > ' c o n f i g _ f i l e ' , c o n t e n t = > t e m p l a t e ( ' f o o / c o n f i g . e r b ' ) , o r d e r = > 2 0 }
  9. STDLIB Standard library (widely used) Curated by Puppet Labs Full

    of useful elements; increasingly necessary
  10. USEFUL LOG OUTPUT Functions for each log level n o

    t i c e ( ) ; w a r n ( ) ; e r r ( ) ; Informative & human-readable