Puppet - egy központi management megoldás

Csillag Tamás <cstamas@digitus.itk.ppke.hu>

http://digitus.itk.ppke.hu/~cstamas

Pásztor György <pasztor@bibl.u-szeged.hu>

http://www.bibl.u-szeged.hu/~pasztor/nws2k7/

Jelen dokumentum a Creative Commons license by-sa alatt érhetõ el.

Előadás áttekintése

  1. Miért?
  2. Managementről általában
  3. Kihívások
  4. A Puppet felépítése, működése
  5. Példák
  6. További célok

Managementről általában

Kihívások

  1. Konzisztencia
    • Fut a gép?
    • Lefutott a parancs? Hibátlanul futott le?
  2. Új gép felvétele
    • Egy új webszerver kerül beállításra, hogyan kezdjünk neki?
  3. Több operációs rendszer
    • Hogyan is kell egy új felhasználót felvenni?
    • Mi az ssh program neve?

Puppet architektúra

Puppet architektúra (2.)

Puppet felépítése

Egyszerű példa

# Make sure the modes on the sudoers file are correct
file { "/etc/sudoers": owner => root, group => root, mode => 644 }
    

Facter

Összetettebb példa

class ntp {
  # Make sure the package is installed
  package { openntpd: ensure => installed }

  # And the configuration file, but the configuration file
  # gets installed after the package, so it overwrites
  file { "/etc/openntpd/ntpd.conf":
    source => "puppet://puppet/global/etc_openntpd_ntpd.conf",
    require => Package[openntpd]
  }

  # And start the service, after both other resources
  # are done and in such a way that it will restart if
  # either changes
  service { openntpd:
    ensure => running,
    subscribe => [Package[openntpd], File["/etc/openntpd/ntpd.conf"]]
  }
}
    

Több operációs rendszer esetén

  class ssh {
  package { ssh: ensure => installed }
  file { sshd_config:
    name => $operatingsystem ? {
      Darwin => "/etc/sshd_config",
      Solaris => "/opt/csw/etc/ssh/sshd_config",
      default => "/etc/ssh/sshd_config"
    },
    source => "puppet://server.domain.com/files/ssh/sshd_config"
  }
  service { ssh:
    name => $operatingsystem ? {
      Solaris => openssh,
      default => ssh
    },
    ensure => running,
    subscribe => [Package[ssh], File[sshd_config]]
  }
}
  

(nem is olyan távoli) Távlati célok

Linkek, hivatkozások