Use -t with puppet agent again instead of onetime --pluginsync. -t also implies...
[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 --no-daemonize --onetime --environment=production
14
15         : ::client:: && me=$(hostname -f) && [ "$me" != "${me%debian.org}" ] && apt-get update &&
16                 apt-get install -y --no-install-recommends puppet ruby-augeas 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                 puppet ca 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                 echo 'puppet agent -t --pluginsync'
49
50 and execute this on the client.
51
52         : ::client:: copy paste the thing you just created on handel
53
54 If this is a busy mail host, you might want to stop exim before proceeding
55 although the config files should remain identical before and after.
56
57 Try this once if you're nervous:
58
59         : ::client:: && puppet agent -t --pluginsync --noop
60
61 It will tell you what would have changed without actually doing it.
62
63 Then run (this will change the configs in /etc):
64
65         : ::client:: && puppet agent -t --pluginsync
66
67 This run will start puppet after reconfiguring it, so if you are
68 unhappy with what just happened, you'll need to stop it again to do
69 repair.
70
71 Double check apt - the puppet setup usually results in duplicate apt
72 sources, since we ship a few under sources.list.d.  Remove any unnecessary
73 entries from sources.list.
74
75 On handel, make sure the certs exist for the new host
76
77
78 We ship a samhain config file that includes /lib and /usr/lib.  This will
79 almost certainly be different than the config file on the machine, so it
80 will result in 1000s of files changed.
81 You may need to run samhain update after getting puppet going.
82
83 The puppet repository is public, but we sometimes need to keep passwords
84 in puppet.  There are many ways to do this - hiera-gpg, ENC, etc.  We've
85 settled on a fairly simple one.  Log into handel, create a new manifest
86 in the relevant module (call is something like "params.pp").  You can add
87 passwords to this file.  To stop git complaining on push, make sure you
88 update .gitignore for the new file.  Now you can import this file where
89 you need passwords and use them.