The first make will back up some files. It is important to run it only once.
The second run, "make" alone, will go through the needed steps for installation: if rsync is not installed, it will install rsync; if the needed files are not present in the /puppet hierarchy, it will download the files using rsync; if puppet is not installed, it will install it; then, it will run puppetd with a bootstrap configuration file and… fail!
Yes, fail. Because you need to sign the host certificate, don't you? Once you signed it on the master node, then you'll run make config
. If everything is properly configured, this will set up your host according to the manifests.
The last command, make test
will just run a puppetd --test
to ensure that everything is properly set up.
And that's all. Installing one host this way takes about 5 minutes, downloads included. And using cssh I could even install puppet on several machines in parallel.
Am I missing something? Oh, yes, the real Makefile 🙂
PUPPETMASTER=i.am.your.master.com SYNCSERVER=$(PUPPETMASTER) all: install config install: /usr/bin/puppetd config: puppetd --config /puppet/common/files/bootstrap/client.conf --server $(PUPPETMASTER) --test test: puppetd --test clean: -rm -rf /puppet -apt-get remove puppet facter -apt-get autoremove backups: cp /etc/apt/sources.list{,.dist} /usr/bin/rsync: apt-get install rsync /puppet/usa/files/sources.list: sync-puppet-conf /puppet/volatile/keys/apt: sync-puppet-conf update: /puppet/usa/files/sources.list /puppet/volatile/keys/apt cp /puppet/usa/files/sources.list /etc/apt/sources.list apt-key add /puppet/volatile/keys/apt apt-get update apt-key update sync-puppet-conf: /usr/bin/rsync rsync -zav $(SYNCSERVER)::PuppetConf /puppet /usr/bin/puppetd: update apt-get install puppet
Funny, I did something similar with bash/Perl scripts.You could also replace rsync with a svn (or git or similar) export from a "development/test/production" branch of a repository. Something like:
svn export http://my.repository/svn/puppet-config/branches/production /puppet
That's more or less what I did for this setup 🙂Thanks for the pointer :)The rsync stuff actually happens on purpose, but I can't say more here. But I'll be happy to share one of these days in the canteen. Today? Friday beer? :)–bronto