Distributed configuration management with puppet on CentOS5

From Bitbull Wiki
Jump to navigation Jump to search

1 description

with centralized configuration management, its easy to manage a huge amount of nodes.
my prefered tool for this task is puppet, lets se how to getting started.
tested on CentOS5

2 install and configure puppet server

node name: pmaster.domain.com
install needed software

yum install puppet puppet-server facter

creating needed directories

mkdir -p /etc/puppet/modules/sudo/manifests
mkdir -p /etc/puppet/modules/sudo/files

create config for our sudo module

vi /etc/puppet/modules/sudo/manifests/init.pp
---
class sudo {

    package { sudo: ensure => latest }

    file { "/etc/sudoers":
        owner   => root,
        group   => root,
        mode    => 440,
        source  => "puppet:///sudo/sudoers",
        require => Package["sudo"],
    }
}

copy sudoers template to getting started with

cp /etc/sudoers /etc/puppet/modules/sudo/files/sudoers

importing modules

vi /etc/puppet/manifests/modules.pp
---
import "sudo"
---

create node configuration file, for deploying config to

vi /etc/puppet/manifests/nodes.pp
---
node basenode {
  include sudo
}

node 'pclient.domain.com' inherits basenode {
}

create master configuration file

vi /etc/puppet/manifests/site.pp
---
import "modules"
import "nodes"

# The filebucket option allows for file backups to the server
filebucket { main: server => 'pmaster.domain.com' }

# Set global defaults - including backing up all files to the main filebucket and adds a global path
File { backup => main }
Exec { path => "/usr/bin:/usr/sbin/:/bin:/sbin" }

3 install and configure the puppet client

node name: pclient.comain.com
install nedded software

yum install puppet facter

set the puppet master

vi /etc/sysconfig/puppet
---
PUPPET_SERVER=pmaster.domain.com
---


4 register the client on the puppet master

do all of this tasks within 3 minutes

node: pclient

/etc/init.d/puppet restart 

node: pmaster

puppetca --list
puppetca --sign pclient.comain.com

now, they are paired and can be used for configuration management

here some useful links:

http://docs.reductivelabs.com
http://reductivelabs.com/trac/puppet/wiki/SimplestPuppetInstallRecipe
http://docs.reductivelabs.com/guides/installation.html
http://reductivelabs.com/trac/puppet/wiki/PuppetModules
http://reductivelabs.com/trac/puppet/wiki/Recipes