I’m currently setting up Puppet at Vquence so that, among other things, we can deploy hosts into Amazon EC2 more easily.
To ensure a minimum setup time on a new server I wanted the setup to be as simple as
- echo ‘DAEMON_OPTS=”-w 120 –fqdn newserver.vquence.com –server puppetmaster.vquence.com” > /etc/default/puppet
- aptitude install puppet
This means that the puppet client will use newserver.vquence.com as the common name in the SSL certificate it creates for itself. On the puppet master the SSL cert name is then used to pick a node rather than the hostname reported by facter.
This means that I don’t need to worry about setting up /etc/hostname, even better /etc/hostname can be managed by puppet.
You can control this functionality on the puppet master by using the node_name option. From the docs
# How the puppetmaster determines the client's identity # and sets the 'hostname' fact for use in the manifest, in particular # for determining which 'node' statement applies to the client. # Possible values are 'cert' (use the subject's CN in the client's # certificate) and 'facter' (use the hostname that the client # reported in its facts) # The default value is 'cert'. # node_name = cert
The problem was that the ‘hostname’ fact wasn’t being set. It looks like there was a regression in SVN#1673 when some refactoring was performed.
I’ve filed bug #1133 and you can clone my git repository.
I haven’t included any tests in the patch as I’m not sure how to. The master.rb test already tests this functionality but doesn’t test that the facts object has actually been changed. I think a test on getconfig is probably required but I’m not sure how you would access the facts after calling it.
Update: This patch is now in puppet as of 0.24.3.