Successfully reported this slideshow.

More Related Content

Related Books

Free with a 14 day trial from Scribd

See all

Related Audiobooks

Free with a 14 day trial from Scribd

See all

20150613 self-puppet v4-avoiding_dragons

  1. 1. Puppet v4 Avoiding Dragons Garrett Honeycutt gh@learnpuppet.com LearnPuppet.com @learnpuppet
  2. 2. AIO
  3. 3. puppet-agent package from PC1 augeas (1.3.0) ruby (2.1.6) cfacter (0.4.1) ruby-augeas (0.5.0) facter (2.4.4) ruby-selinux (2.0.94) hiera (2.0.1) ruby-shadow (2.3.3) marionette-collective (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)
  4. 4. Bye Bye Apache+Passenge r
  5. 5. Hello JVM+Closure+JRu by
  6. 6. Ruby 1.8.7 RIP
  7. 7. OSX <= 10.6 (snow leopard) RIP
  8. 8. Where is everything?
  9. 9. Mostly under /opt/puppetlabs
  10. 10. /opt/puppetlabs/bin Add to $PATH
  11. 11. /opt/puppetlabs/puppet/bin Private programs for Puppet such as ruby and gem
  12. 12. configuration is in /etc/puppetlabs/puppet
  13. 13. $ ls /etc/puppetlabs code mcollective puppet puppetserver
  14. 14. SSL where!? /etc/puppetlabs/puppet/ssl
  15. 15. /etc/puppetlabs/code Hiera configuration Hiera data Static modules Environments
  16. 16. Environments /etc/puppetlabs/code/environments
  17. 17. Many type/provider improvements
  18. 18. Facts are not all strings
  19. 19. $ facter os --yaml --- os: name: CentOS family: RedHat release: major: '7' minor: '1' full: 7.1.1503
  20. 20. class foo ( $bar = true, ) { if is_string($bar) == true { $bar_real = str2bool($bar) } else { $bar_real = $bar } validate_bool($bar_real) }
  21. 21. Templates with EPP epp(module/foo.epp)
  22. 22. Language
  23. 23. Iteration with lambdas .each is here
  24. 24. $list = ['a','b','c'] each($list) |$index, $value| { notice("${index} = ${value}") }
  25. 25. Notice: Scope(Class[main]): 0 = a Notice: Scope(Class[main]): 1 = b Notice: Scope(Class[main]): 2 = c
  26. 26. ['a','b','c'].each |$index, $value| { notice("${index} = ${value}") }
  27. 27. Notice: Scope(Class[main]): 0 = a Notice: Scope(Class[main]): 1 = b Notice: Scope(Class[main]): 2 = c
  28. 28. Lambdas .each .slice .filter .map .reduce .with
  29. 29. Type casting
  30. 30. class foo ( $bar = true, ) { if is_string($bar) == true { $bar_real = str2bool($bar) } else { $bar_real = $bar } validate_bool($bar_real) }
  31. 31. class foo ( Boolean $bar = true, ) { # Remove all this code! # # if is_string($bar) == true { # $bar_real = str2bool($bar) # } else { # $bar_real = $bar # } # validate_bool($bar_real) }
  32. 32. String Integer, Float, and Numeric Boolean Array Hash Regexp Undef Default
  33. 33. Scalar Struct Collection Optional Variant Catalogentry Data Type Pattern Any Enum Callable Tuple
  34. 34. Upgrading
  35. 35. Never upgrade in place
  36. 36. Create new puppet masters
  37. 37. common nscd rsyslog dnsclient nsswitch selinux facter ntp ssh hosts pam sysklogd inittab papertrail timezone localization puppet types nfs redhat utils nrpe rpcbind vim
  38. 38. Travis-ci
  39. 39. # spec/spec_helper.rb RSpec.configure do |config| config.before :each do Puppet[:parser] = 'future' if ENV['PARSER'] == 'future' end end
  40. 40. # .travis.yml env: matrix: - PUPPET_GEM_VERSION="~> 3.1" - PUPPET_GEM_VERSION="~> 3.2" - PUPPET_GEM_VERSION="~> 3.3" - PUPPET_GEM_VERSION="~> 3.4" - PUPPET_GEM_VERSION="~> 3.5" - PUPPET_GEM_VERSION="~> 3.6" - PUPPET_GEM_VERSION="~> 3.7" - PUPPET_GEM_VERSION="~> 3.8" - PUPPET_GEM_VERSION="~> 3" PARSER="future" - PUPPET_GEM_VERSION="~> 4.0" - PUPPET_GEM_VERSION="~> 4.1" - PUPPET_GEM_VERSION="~> 4"
  41. 41. # .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
  42. 42. Resource Overrides
  43. 43. Service ['nfs_service'] { ensure => running, enable => true, hasstatus => true, hasrestart => true, }
  44. 44. Service['nfs_service'] { ensure => running, enable => true, hasstatus => true, hasrestart => true, }
  45. 45. type()
  46. 46. Error: Illegal expression. A Reserved Word 'type' is unacceptable as function name
  47. 47. type3x()
  48. 48. stdlib
  49. 49. puppetlabs/stdlib >= 4.6.0 < 6.0.0 v4.6.0 includes type3x()
  50. 50. validate_absolute_path() Now accepts arrays :) Broke my spec tests :(
  51. 51. Error codes changed slightly Broke my spec tests :(
  52. 52. 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
  53. 53. Got rid of '^' in regex so it was not being as explicit.
  54. 54. Templates
  55. 55. Must have @var instead of just var. Check inline_template() too.
  56. 56. Stop using inline_template()
  57. 57. Node Inheritance RIP
  58. 58. node common { include ssh } node 'f.example.com' inherits common { include apache }
  59. 59. Upgrade Checklist * setup Travis (or equiv) * test * test * test
  60. 60. Puppet v4 Avoiding Dragons Garrett Honeycutt gh@learnpuppet.com LearnPuppet.com @learnpuppet

×