Docsity

Configuration Management with Puppet: A Comprehensive Guide, Lecture notes of Architecture

Partial preview of the text

Download Configuration Management with Puppet: A Comprehensive Guide and more Lecture notes Architecture in PDF only on Docsity!

Configuration

Management

with Puppet

Introduction

What is Puppet

● is a configuration management system

● is a programming language

● offers a Client/Server architecture

● has a huge community

● widely used in the IT industry

● commercial support available if needed

Puppet process - Step 1

registration

Example: foreman, satellite, spacewalk ... Creates: Kickstart File and Puppet Node definition

Puppet process - Step 2

provisioning

Tool: Redhat anaconda, Ubuntu Fai, cobbler, preseed Input: anaconda configured by kickstart file preseed config file … Result: Installing minimal linux and puppet, and start Puppet after reboot

Contents

● Resources

● Manifests

● Ordering

● Variables, Conditionals, and Facts

● Classes

● Module

Resources

All elements of a node will be described as

resources

● Files

● User

● Services

● ... (about 50)

Example Resource

user { 'dave':

ensure => present,

uid => '507',

gid => 'admin',

shell => '/bin/zsh',

home => '/home/dave',

managehome => true,

Ressource shell

You can interact with the RAL directly.

● puppet resource user root

● puppet resource user dave \

ensure=present shell="/bin/zsh" \

home="/home/dave" managehome=true

Resource basic

● file vs. augeas

● yumrepo stages

● package ensure latest?

● exec only if needed

Manifests

● manifests are puppet programs

● puppet programs

○ declare resources

○ define conditions

○ group resources

○ generate text

○ link other manifests

○ define ordering

Manifests Run

actual status defined status

Puppet Action

/etc/service.conf

/etc/init.d/service: not running /etc/init.d/service: running

write file

start service

no file /etc/service.conf /etc/service.conf

start service

Manifests example!

file {'/tmp/test1': ensure => present, content => "Hi.", }

file {'/tmp/test2': ensure => directory, mode => 0644, }

file {'/tmp/test3': ensure => link, target => '/tmp/test1', }

notify {"I'm notifying you.":} notify {"So am I!":}

Facts example!

host {'self': ensure => present, name => $fqdn, host_aliases => [ 'puppet', $hostname ] , ip => $ipaddress, }

file {'motd': ensure => file, path => '/etc/motd', mode => 0644, content => "Welcome to ${hostname},\na ${operatingsystem} island in the sea of ${domain}.\n", }

Conditionals a first example!

if $is_virtual == 'true' { service {'ntpd': ensure => stopped, enable => false , } } else { service { 'ntpd': name => 'ntpd', ensure => running, enable => true , hasrestart => true , require => Package [ 'ntp' ] , } }