DevOpsDays Taipei 2018 - Puppet 古早味、新感受:改造老牌企業進入自動化時代

DevOpsDays Taipei 2018 - Puppet 古早味、新感受:改造老牌企業進入自動化時代

62a517c88ea8bfc9c5f9ff6720e8b00a?s=128

scott.liao (Mr. 沙先生)

September 10, 2018
Tweet

Transcript

  1.      -- We can do it.

    scott.liao  Mr.  <shazi7804@gmail.com>
  2. 104   DevOps, AWS and more … • Blog

    Mr.  • Gitbook Puppet   • Github @shazi7804 • iT   Ops  - Puppet  
  3. Puppet x 104

  4. What’s Puppet

  5.  x IaC x 

  6. vs. vs.

  7. Why Puppet

  8.     "  Github  ! AWS

    
  9. *

  10.  104  DevOps 

  11. How To ….

  12. None
  13. 

  14.  DevOps

  15. Who care

  16. Who cares ⣐褕茒▁ U

  17.      

  18.        *

  19.      * 

  20.      *   

  21. None
  22.       1 2 3 PLANNING

  23.       1 2 3 PLANNING

    • Users, Groups • SNMP • Hostname • Motd • Profile • NTP • Backup
  24.       1 2 3 PLANNING

    • Users, Groups • SNMP • Hostname • Motd • Profile • NTP • Backup • Apache / Tomcat / Java • Apache / PHP • Nginx / NodeJS • Nginx / PHP • Nginx / Python
  25.       1 2 3 PLANNING

    • Users, Groups • SNMP • Hostname • Motd • Profile • NTP • Backup • Apache / Tomcat / Java • Apache / PHP • Nginx / NodeJS • Nginx / PHP • Nginx / Python •   •   • All Server
  26. Manifest node ^www\.104\.com\.tw$ { # manage basic configuration package {

    'ntp': ensure => present } # manage users and groups group { 'devopsdays': ensure => present } user { 'scott.liao': ensure => present, comment => ’DevOpsDays Taipei 2018 speaker', home => '/104corp/scott.liao', groups => 'devopsdays', } # manage application package { 'apache2': ensure => present } package { 'php7.0': ensure => present } } •   •  Ansible  playbook • Puppet  Coding
  27. Coding Module •   •  class basic {

    package { 'ntp': ensure => present } } class users { group { 'devopsdays': ensure => present } user { 'scott.liao': ensure => present, comment => 'DevOpsDays Taipei 2018 speaker', home => '/104corp/scott.liao', groups => 'devopsdays', } } class web { package { 'apache2': ensure => present } package { 'php7.0': ensure => present } }
  28. Coding Role and Profile •  •   class

    role::web { include profile::basic include profile::users include profile::web } class profile::basic { … } class profile::users { … } class profile::web { … } node ^www\.104\.com\.tw$ { include role::web }
  29.  CronJob 

  30. Sync of puppet runinterval (default)

  31. Sync of puppet fqdn_rand # When reboot after sync puppet

    @reboot /opt/puppetlabs/bin/puppet agent –t # Generates random time of sync puppet 2,12,22,32,42,52 * * * * sleep 12; /opt/puppetlabs/bin/puppet agent –t • Hash with fqdn • random and limit
  32.  CI / CD  IaC

  33. IaC with Puppet CI / CD •  • 

     •  •  hiera   •  |-- Gemfile |-- Puppetfile |-- Rakefile |-- autosign.conf |-- data |-- environments |-- dev |-- production |-- hiera.yaml |-- private |-- profile |-- role |-- spec # module manage # node auto sign # hiera data # manifests # hiera config # private module # profile # role # test case
  34. IaC with Puppet Module manage • Framework • r10k •

    librarian-puppet • Module provider • Puppetlabs • voxpupuli (Github) • official
  35. IaC with Puppet Test Framework • rspec-puppet (unit test) •

    puppet-lint (coding style) • puppetlabs_spec_helper (module testing) • beaker-rspec (acceptance test)
  36.     facter 

  37. Facter and Dashboard Node PuppetDB Dashboard • Dashboard • Puppet

    Enterprise • Puppetboard • Grafana with prometheus_reporter • Custom from Puppetdb
  38. Puppet in 104 Corp 727 Population 118401 Resource 1Y7M Time

    10 Module
  39. We can do it.

  40. Thank You

  41. None
  42. None