PUPPET » Historique » Version 2
Mehdi Abaakouk, 02/01/2012 17:02
1 | 2 | Mehdi Abaakouk | h1. master of puppet (http://youtu.be/Y-1sEcEz0sg) |
---|---|---|---|
2 | 1 | Mehdi Abaakouk | |
3 | 2 | Mehdi Abaakouk | |
4 | 1 | Mehdi Abaakouk | h2. Ajout d'une machine: |
5 | 1 | Mehdi Abaakouk | |
6 | 1 | Mehdi Abaakouk | Sur le client: |
7 | 1 | Mehdi Abaakouk | |
8 | 1 | Mehdi Abaakouk | <pre> |
9 | 1 | Mehdi Abaakouk | $ apt-get install puppet |
10 | 1 | Mehdi Abaakouk | </pre> |
11 | 1 | Mehdi Abaakouk | |
12 | 1 | Mehdi Abaakouk | dans /etc/default/puppet mettre: |
13 | 1 | Mehdi Abaakouk | <pre> |
14 | 1 | Mehdi Abaakouk | START=yes |
15 | 1 | Mehdi Abaakouk | </pre> |
16 | 1 | Mehdi Abaakouk | |
17 | 1 | Mehdi Abaakouk | et dans /etc/puppet/puppet.conf ajouter: |
18 | 1 | Mehdi Abaakouk | <pre> |
19 | 1 | Mehdi Abaakouk | [agent] |
20 | 1 | Mehdi Abaakouk | server=puppet.tetaneutral.net |
21 | 1 | Mehdi Abaakouk | </pre> |
22 | 1 | Mehdi Abaakouk | |
23 | 1 | Mehdi Abaakouk | Ensuite ajouter la machine dans le puppet master, MOUAHAHA: |
24 | 1 | Mehdi Abaakouk | Sur le client: |
25 | 1 | Mehdi Abaakouk | <pre> |
26 | 1 | Mehdi Abaakouk | $ puppet agent --test |
27 | 1 | Mehdi Abaakouk | warning: peer certificate won't be verified in this SSL session |
28 | 1 | Mehdi Abaakouk | warning: peer certificate won't be verified in this SSL session |
29 | 1 | Mehdi Abaakouk | warning: peer certificate won't be verified in this SSL session |
30 | 1 | Mehdi Abaakouk | Exiting; no certificate found and waitforcert is disabled |
31 | 1 | Mehdi Abaakouk | </pre> |
32 | 1 | Mehdi Abaakouk | |
33 | 1 | Mehdi Abaakouk | Sur le serveur: |
34 | 1 | Mehdi Abaakouk | <pre> |
35 | 1 | Mehdi Abaakouk | $ puppetca --list |
36 | 1 | Mehdi Abaakouk | www.tetaneutral.net |
37 | 1 | Mehdi Abaakouk | |
38 | 1 | Mehdi Abaakouk | $ puppetca --sign --all |
39 | 1 | Mehdi Abaakouk | notice: Signed certificate request for www.tetaneutral.net |
40 | 1 | Mehdi Abaakouk | notice: Removing file Puppet::SSL::CertificateRequest www.tetaneutral.net at '/var/lib/puppet/ssl/ca/requests/www.tetaneutral.net.pem' |
41 | 1 | Mehdi Abaakouk | </pre> |
42 | 1 | Mehdi Abaakouk | |
43 | 1 | Mehdi Abaakouk | Sur le client: |
44 | 1 | Mehdi Abaakouk | <pre> |
45 | 1 | Mehdi Abaakouk | $ puppet agent --test |
46 | 1 | Mehdi Abaakouk | warning: peer certificate won't be verified in this SSL session |
47 | 1 | Mehdi Abaakouk | info: Caching certificate for www.tetaneutral.net |
48 | 1 | Mehdi Abaakouk | info: Caching certificate_revocation_list for ca |
49 | 1 | Mehdi Abaakouk | info: Caching catalog for www.tetaneutral.net |
50 | 1 | Mehdi Abaakouk | info: Applying configuration version '1325516709' |
51 | 1 | Mehdi Abaakouk | info: Creating state file /var/lib/puppet/state/state.yaml |
52 | 1 | Mehdi Abaakouk | notice: Finished catalog run in 0.01 seconds |
53 | 1 | Mehdi Abaakouk | </pre> |
54 | 1 | Mehdi Abaakouk | |
55 | 2 | Mehdi Abaakouk | |
56 | 2 | Mehdi Abaakouk | h2. Liens: |
57 | 2 | Mehdi Abaakouk | |
58 | 2 | Mehdi Abaakouk | http://madeinsyria.fr/2011/06/howto-puppet-administration-et-industrialisation-de-masse/ |
59 | 2 | Mehdi Abaakouk | |
60 | 2 | Mehdi Abaakouk | h2. Ajout d'un module (ie: un truc/service/user a configurer), ici module motdpour l'exemple : |
61 | 2 | Mehdi Abaakouk | |
62 | 2 | Mehdi Abaakouk | h3. Création du module |
63 | 2 | Mehdi Abaakouk | |
64 | 2 | Mehdi Abaakouk | <pre> |
65 | 2 | Mehdi Abaakouk | cd /etc/puppet/modules |
66 | 2 | Mehdi Abaakouk | mkdir -p motd/{files,lib,manifests,templates,tests} |
67 | 2 | Mehdi Abaakouk | $ cat motd/manifests/init.pp |
68 | 2 | Mehdi Abaakouk | class motd { |
69 | 2 | Mehdi Abaakouk | file {'motd': |
70 | 2 | Mehdi Abaakouk | ensure => file, |
71 | 2 | Mehdi Abaakouk | path => '/etc/motd.tail', |
72 | 2 | Mehdi Abaakouk | mode => 0644, |
73 | 2 | Mehdi Abaakouk | content => "Bienvenue sur ${::hostname}, machine de l'infrastructure ${::domain}\n\nCette machine est geree par puppet toutes modifications effectuee est suceptible d'etre perdu." |
74 | 2 | Mehdi Abaakouk | } |
75 | 2 | Mehdi Abaakouk | } |
76 | 2 | Mehdi Abaakouk | </pre> |
77 | 2 | Mehdi Abaakouk | |
78 | 2 | Mehdi Abaakouk | |
79 | 2 | Mehdi Abaakouk | h3. Ajout du module à la liste des modules disponibles |
80 | 2 | Mehdi Abaakouk | |
81 | 2 | Mehdi Abaakouk | <pre> |
82 | 2 | Mehdi Abaakouk | $ cat manifests/modules.pp |
83 | 2 | Mehdi Abaakouk | import "backup" |
84 | 2 | Mehdi Abaakouk | import "motd" |
85 | 2 | Mehdi Abaakouk | </pre> |
86 | 2 | Mehdi Abaakouk | |
87 | 2 | Mehdi Abaakouk | h3. Utilisation du module pour une node |
88 | 2 | Mehdi Abaakouk | |
89 | 2 | Mehdi Abaakouk | <pre> |
90 | 2 | Mehdi Abaakouk | $ cat manifests/nodes.pp |
91 | 2 | Mehdi Abaakouk | |
92 | 2 | Mehdi Abaakouk | node basenode { |
93 | 2 | Mehdi Abaakouk | include backup |
94 | 2 | Mehdi Abaakouk | include motd |
95 | 2 | Mehdi Abaakouk | } |
96 | 2 | Mehdi Abaakouk | |
97 | 2 | Mehdi Abaakouk | node 'www.tetaneutral.net' inherits basenode { |
98 | 2 | Mehdi Abaakouk | |
99 | 2 | Mehdi Abaakouk | } |
100 | 2 | Mehdi Abaakouk | </pre> |
101 | 1 | Mehdi Abaakouk | |
102 | 1 | Mehdi Abaakouk | |
103 | 1 | Mehdi Abaakouk | h2. Installation |
104 | 1 | Mehdi Abaakouk | |
105 | 1 | Mehdi Abaakouk | Installation du paquet: |
106 | 1 | Mehdi Abaakouk | <pre> |
107 | 1 | Mehdi Abaakouk | $ apt-get install puppetmaster |
108 | 1 | Mehdi Abaakouk | </pre> |
109 | 1 | Mehdi Abaakouk | |
110 | 1 | Mehdi Abaakouk | |
111 | 1 | Mehdi Abaakouk | Dans /etc/puppet/puppet.conf mettre le nom du serveur puppetmaster: |
112 | 1 | Mehdi Abaakouk | <pre> |
113 | 1 | Mehdi Abaakouk | [master] |
114 | 1 | Mehdi Abaakouk | certname=puppet.tetaneutral.net |
115 | 1 | Mehdi Abaakouk | </pre> |
116 | 1 | Mehdi Abaakouk | |
117 | 1 | Mehdi Abaakouk | Dans /etc/puppet/fileserver.conf configurer les autorisations: |
118 | 1 | Mehdi Abaakouk | <pre> |
119 | 1 | Mehdi Abaakouk | [files] |
120 | 1 | Mehdi Abaakouk | path /etc/puppet/files |
121 | 1 | Mehdi Abaakouk | allow 91.224.149.0/24 |
122 | 1 | Mehdi Abaakouk | allow 91.224.148.0/24 |
123 | 1 | Mehdi Abaakouk | </pre> |