Puppet agent can’t find server
Written by: J Dawg
I’m new to puppet, but picking it up quickly. Today, I’m running into an issue when trying to run the following:
$ puppet agent --no-daemonize --verbose --onetime **err: Could not request certificate: getaddrinfo: Name or service not known Exiting; failed to retrieve certificate and waitforcert is disabled**
It would appear the agent doesn’t know what server to connect to. I could just specify
--server on the command line, but that will be of no use to me when this runs as a daemon in production, so instead, I specify the server name in /etc/puppet/puppet.conf like so:
server = puppet.<my domain>
I do have a DNS entry for
puppet.<my domain> and if I
dig puppet.<my domain>, I see that the name resolves correctly.
All puppet documentation I have read states that the agent tries to connect to a puppet master at
puppet by default and your options are host file trickery or do the right thing, create a CNAME in DNS, and edit the puppet.conf accordingly, which I have done.
So what am I missing? Any help is greatly appreciated!
D’oh! Need to sudo to do this! Then everything works.
I actually had the same error but I was using the two learning puppet vm and trying run the ‘puppet agent –test’ command.
I solved the problem by opening the file /etc/hosts on both the master and the agent vm and the line
***.***.***.*** learn.localdomain learn puppet.localdomain puppet
The ip address (the asterisks) was originally some random number. I had to change this number on both vm so that it was the ip address of the master node.
So I guess for experienced users my advice is to check the /etc/hosts file to make sure that the ip addresses in here for the master and agent not only match but are the same as the ip address of the master.
for other noobs like me my advice is to read the documentation more clearly. This was a step in the ‘setting up an agent vm’ process the I totally missed xD
I had to use the
sudo puppet agent --noop --server=puppet.example.org