Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

20150613 self-puppet v4-avoiding_dragons

863 views

Published on

Published in: Engineering
  • Be the first to comment

  • Be the first to like this

20150613 self-puppet v4-avoiding_dragons

  1. 1. Puppetv4 Avoiding Dragons Garrett Honeycutt gh@| earnpuppet. com Learn Puppet. com @| earnpuppet
  2. 2. puppet—agent package from PC1 augeas (1.3.0) ruby (2.1.6) cfacter (O.4.1) ruby—augeas (O.5.0) facter (2.4.4) ruby—se| inux (2.0.94) hiera (2.0.1) ruby—shadow (2.3.3) marionette—co| |ective (2.8.2) ruby—stomp (1.3.3) openssl (1.0.0r) rubygem—deep—merge (1.0.0) puppet (4.1.0) rubygem—net—ssh (2.1.4) virt—what (1.1.4)
  3. 3. Bye Bye Apache+Passenge r
  4. 4. Hello JVM+C| osu re+J Ru by
  5. 5. Ruby 1.8.7 RIP
  6. 6. OSX <= 10.6 (snow leopard) RIP
  7. 7. Where is everything?
  8. 8. Mostly under / Opt/ puppetlabs
  9. 9. /opt/ puppetlabs/ bin Add to $ PATH
  10. 10. /opt/ puppetlabs/ puppet/ bin Private programs for Puppet SUCh as ruby and gem
  11. 11. configuration is in / etc/ puppetlabs/ puppet
  12. 12. $ ls / etc/ puppetlabs code mcollective Puppet puppetserver
  13. 13. SSL wherel? / etc/ puppetlabs/ puppet/ Ssl
  14. 14. /etc/ puppetlabs/ Code Hiera configuration Hiera data Static modules Environments
  15. 15. Environments / etc/ puppetlabs/ code/ environments
  16. 16. Many type/ provider improvements
  17. 17. Facts are not all strings
  18. 18. S facter os ——yaml os: name: CentOS family: Redflat release: major: '7' minor: '1' full: 7.1.1503
  19. 19. class foo ( Sbar = true, ) { if is_string($bar) = = true { $bar_real = str2bOol($bar) } else { $bar_real = $bar } validate_bool($bar_real)
  20. 20. Templates with EPP epp(module/ foo. epp)
  21. 21. Language
  22. 22. Iteration with lambdas . each is here
  23. 23. $list = ['a', 'b', 'c'] each($list) | $index, $value| { notice("${index} = ${value}")
  24. 24. Notice: Notice: Notice: Scope(Class[main]): Scope(Class[main]): Scope(Class[main]): O l 2 ll DJ
  25. 25. ['a', 'b', 'c']. each | $index, $value| { notice("${index} = ${value}")
  26. 26. Notice: Notice: Notice: Scope(Class[main]): Scope(Class[main]): Scope(Class[main]): O l 2 ll DJ
  27. 27. Lambdas . each . slice . filter . map . reduce . with
  28. 28. Type casting
  29. 29. class foo ( $bar = ) { true, if is_string($bar) $bar_real } else { $bar_real } true { str2bool($bar) $bar validate_bool($bar_real)
  30. 30. class foo ( Boolean $bar = true, { Remove all this code! if is_striDg($bar) = = true { $bar_real = str2bool($bar) } else { $bar_real = Sbar } validate_bool($bar_real) Ev-’= l=l= =l= l== l=l= =l= l== l=l= =l= l== l=l= =l= l=‘-’
  31. 31. String Integer, Float, and Numeric Boolean Array Hash Regexp Undef Default
  32. 32. Scalar Struct Collection Optional Variant Catalogentry Data Type Pattern Any Enum Callable Tuple
  33. 33. Upgrading
  34. 34. Never upgrade in place
  35. 35. Create new PUPPet masters
  36. 36. common nscd rsystog dnsctient nsswitch setinux facter ntp ssh hosts pam sysktogd inittab papertrait timezone Localization puppet types nfs redhat utits nrpe rpcbind vim
  37. 37. Travis—ci
  38. 38. # spec/ spec_heLper. rb RSpec. configure do lconfigl config. before zeach do Puppet[: parser] 'future' if ENV['PARSER'] = 'future' end end
  39. 39. V/ Eiicfijifiliiis "~ » 2; ‘ ‘M '1 VfE2%CEI: iT Ibis " > 7% i 2% " 1: is I! ) 1.‘) ‘ _r'’ I! ) 1.‘) {fill > V4‘, ‘7/ II ) 2; 2:" ) > V 2 in
  40. 40. # . travis yml language: ruby rvm: — 2.1.0 sudo: false env: matrix: - PUPPET_GEM_VERSION= ”~> 3” PARSER= ”future” — PUPPET_GEM_VERSION= ”~> 4” script: ‘bundle exec metadata—json—lint metadata. json && bundle exec rake validate && bundle exec rake lint && SPEC_OPTS= ”—— format documentation” bundle exec rake spec’ matrix: fast_finish: true notifications: email: false
  41. 41. Resource Overrides
  42. 42. Service ensure = > enable = > hasstatus = > hasrestart = > ['nfs_service'] running, true, true, true, {
  43. 43. Service['nfs_service'] { ensure = > running, enable = > true, hasstatus = > true, hasrestart = > true,
  44. 44. type()
  45. 45. Error Illegal expression A Reserved Word ftype is unacceptable as function name
  46. 46. type3x()
  47. 47. stdlib
  48. 48. puppetlabs/ stdlib >= 4.6.0 < 6.0.0 v4.6.0 includes type3x ()
  49. 49. validate_absolute_path() Now accepts arrays : ) Broke my spec tests : (
  50. 50. Error codes changed slightly Broke my spec tests : (
  51. 51. expected Puppet Error with message matching / “true is not a string/ , got #<Puppet Error Evaluation Error Error while evaluating a Function Call, true is not a string It looks to be a TrueClass
  52. 52. Got rid of ‘A’ in regex so it was not being as explicit.
  53. 53. Templates
  54. 54. Must have @var instead ofjust var. Check inline_template () 1200.
  55. 55. Stop using inline_template()
  56. 56. Node lnherfiance RH’
  57. 57. node common { include ssh node 'f. example. com‘ inherits common { include apache
  58. 58. Upgrade Checklist * setup Travis (or equiv) * test * test * test
  59. 59. Puppetv4 Avoiding Dragons Garrett Honeycutt gh@| earnpuppet. com Learn Puppet. com @| earnpuppet

×