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

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

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

scott.liao (Mr. 沙先生)

September 10, 2018
Tweet

More Decks by scott.liao (Mr. 沙先生)

Other Decks in Technology

Transcript

  1. 104   DevOps, AWS and more … • Blog

    Mr.  • Gitbook Puppet   • Github @shazi7804 • iT   Ops  - Puppet  
  2.       1 2 3 PLANNING

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

    • Users, Groups • SNMP • Hostname • Motd • Profile • NTP • Backup • Apache / Tomcat / Java • Apache / PHP • Nginx / NodeJS • Nginx / PHP • Nginx / Python
  4.       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
  5. 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
  6. 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 } }
  7. 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 }
  8. 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
  9. 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
  10. IaC with Puppet Module manage • Framework • r10k •

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

    puppet-lint (coding style) • puppetlabs_spec_helper (module testing) • beaker-rspec (acceptance test)
  12. Facter and Dashboard Node PuppetDB Dashboard • Dashboard • Puppet

    Enterprise • Puppetboard • Grafana with prometheus_reporter • Custom from Puppetdb