need to enable new puppet
[mirror/dsa-wiki.git] / input / howto / puppet-setup.mdwn
1 # Puppet infrastructure
2
3 handel.debian.org is our current puppetmaster.  Currently, it handles
4 configuration of samhain, munin, apt, and exim (although more to come -
5 this list is likely to get out of date quickly).
6
7 To set up a new host to be a puppet client, do the following:
8
9 Make sure you have set up the IP address for the new machine in ud-ldap.
10 After that run puppet on puppetmaster once, so the ferm config get
11 adjusted.
12
13         : __handel__ && puppet agent -t --environment=production
14
15         : ::client:: && me=$(hostname -f) && [ "$me" != "${me%debian.org}" ] && apt-get update &&
16                 apt-get install -y --no-install-recommends puppet libaugeas-ruby1.8 augeas-lenses lsb-release &&
17                 service puppet stop &&
18                 (puppet agent -t || true ) &&
19                 cd /var/lib/puppet/ssl/certificate_requests &&
20                 echo sha256sum output: && echo &&
21                 sha256sum $me.pem &&
22                 echo && echo && cd /
23
24 This will not overwrite anything yet, since handel has not signed the
25 client cert.  Now is the time to abort if you are getting cold feet.
26
27 Compare incoming csr request:
28 on handel, paste the sha256output::
29
30         : __handel__ &&
31                 ud-replicate && sudo -u puppet make -C /srv/puppet.debian.org/ca/ install &&
32                 echo "paste sha256sum output now:" &&
33                 read sha256 filename &&
34                 cd /var/lib/puppet/ssl/ca/requests &&
35                 ( [ -e $filename ] || (echo "$filename does not exist."; exit 1) ) &&
36                 echo -e "$sha256  $filename" | sha256sum -c &&
37                 puppetca --sign $(basename "$filename" .pem) &&
38                 echo && echo && echo &&
39                 echo 'cat > /var/lib/puppet/ssl/certs/ca.pem << EOF ' &&
40                 cat /var/lib/puppet/ssl/certs/ca.pem &&
41                 echo 'EOF' &&
42                 echo "cat > /var/lib/puppet/ssl/certs/$filename << EOF " &&
43                 cat /var/lib/puppet/ssl/ca/signed/$filename &&
44                 echo 'EOF' &&
45                 cd / &&
46                 echo 'puppet agent --enable' &&
47                 echo 'puppet agent -t --pluginsync'
48
49 and execute this on the client.
50
51         : ::client:: copy paste the thing you just created on handel
52
53 If this is a busy mail host, you might want to stop exim before proceeding
54 although the config files should remain identical before and after.
55
56 Try this once if you're nervous:
57
58         : ::client:: && puppet agent -t --pluginsync --noop
59
60 It will tell you what would have changed without actually doing it.
61
62 Then run (this will change the configs in /etc):
63
64         : ::client:: && puppet agent -t --pluginsync
65
66 This run will start puppet after reconfiguring it, so if you are
67 unhappy with what just happened, you'll need to stop it again to do
68 repair.
69
70 Double check apt - the puppet setup usually results in duplicate apt
71 sources, since we ship a few under sources.list.d.  Remove any unnecessary
72 entries from sources.list.
73
74 On handel, make sure the certs exist for the new host
75
76
77 We ship a samhain config file that includes /lib and /usr/lib.  This will
78 almost certainly be different than the config file on the machine, so it
79 will result in 1000s of files changed.
80 You may need to run samhain update after getting puppet going.
81
82 The puppet repository is public, but we sometimes need to keep passwords
83 in puppet.  There are many ways to do this - hiera-gpg, ENC, etc.  We've
84 settled on a fairly simple one.  Log into handel, create a new manifest
85 in the relevant module (call is something like "params.pp").  You can add
86 passwords to this file.  To stop git complaining on push, make sure you
87 update .gitignore for the new file.  Now you can import this file where
88 you need passwords and use them.