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