Projet

Général

Profil

PUPPET » Historique » Version 4

Version 3 (Mehdi Abaakouk, 02/01/2012 17:02) → Version 4/69 (Mehdi Abaakouk, 02/01/2012 17:03)

h1. master of puppet

http://youtu.be/Y-1sEcEz0sg

h2. Ajout d'une machine:

Sur le client:

<pre>
$ apt-get install puppet
</pre>

dans /etc/default/puppet mettre:
<pre>
START=yes
</pre>

et dans /etc/puppet/puppet.conf ajouter:
<pre>
[agent]
server=puppet.tetaneutral.net
</pre>

Ensuite ajouter la machine dans le puppet master, MOUAHAHA:
Sur le client:
<pre>
$ puppet agent --test
warning: peer certificate won't be verified in this SSL session
warning: peer certificate won't be verified in this SSL session
warning: peer certificate won't be verified in this SSL session
Exiting; no certificate found and waitforcert is disabled
</pre>

Sur le serveur:
<pre>
$ puppetca --list
www.tetaneutral.net

$ puppetca --sign --all
notice: Signed certificate request for www.tetaneutral.net
notice: Removing file Puppet::SSL::CertificateRequest www.tetaneutral.net at '/var/lib/puppet/ssl/ca/requests/www.tetaneutral.net.pem'
</pre>

Sur le client:
<pre>
$ puppet agent --test
warning: peer certificate won't be verified in this SSL session
info: Caching certificate for www.tetaneutral.net
info: Caching certificate_revocation_list for ca
info: Caching catalog for www.tetaneutral.net
info: Applying configuration version '1325516709'
info: Creating state file /var/lib/puppet/state/state.yaml
notice: Finished catalog run in 0.01 seconds
</pre>

Sur le serveur, on associe les modules au client:

<pre>
$ cat manifests/nodes.pp

node basenode {
include backup
include motd
}

node 'www.tetaneutral.net' inherits basenode {
}
</pre>


h2. Liens:

http://madeinsyria.fr/2011/06/howto-puppet-administration-et-industrialisation-de-masse/

h2. Ajout d'un module (ie: un truc/service/user a configurer), ici module motdpour l'exemple :

h3. Création du module

<pre>
cd /etc/puppet/modules
mkdir -p motd/{files,lib,manifests,templates,tests}
$ cat motd/manifests/init.pp
class motd {
file {'motd':
ensure => file,
path => '/etc/motd.tail',
mode => 0644,
content => "Bienvenue sur ${::hostname}, machine de l'infrastructure ${::domain}\n\nCette machine est geree par puppet toutes modifications effectuee est suceptible d'etre perdu."
}
}
</pre>

h3. Ajout du module à la liste des modules disponibles

<pre>
$ cat manifests/modules.pp
import "backup"
import "motd"
</pre>

h3. Utilisation du module pour une node

<pre>
$ cat manifests/nodes.pp

node basenode {
include backup
include motd
}

node 'www.tetaneutral.net' inherits basenode {

}
</pre>

h2. Installation

Installation du paquet:
<pre>
$ apt-get install puppetmaster
</pre>

Dans /etc/puppet/puppet.conf mettre le nom du serveur puppetmaster:
<pre>
[master]
certname=puppet.tetaneutral.net
</pre>

Dans /etc/puppet/fileserver.conf configurer les autorisations:
<pre>
[files]
path /etc/puppet/files
allow 91.224.149.0/24
allow 91.224.148.0/24
</pre>