3
votes

I m actually trying to create an Agent from Puppet and I m facing a problem.

In fact, I have the standard generated puppet.conf file in my agent that globally look like this :

[main]
logdir=/var/log/puppet
vardir=/var/lib/puppet
ssldir=/var/lib/puppet/ssl
rundir=/var/run/puppet
factpath=$vardir/lib/facter
templatedir=$confdir/templates
prerun_command=/etc/puppet/etckeeper-commit-pre
postrun_command=/etc/puppet/etckeeper-commit-post

[master]
# These are needed when the puppetmaster is run by passenger
# and can safely be removed if webrick is used.
ssl_client_header = SSL_CLIENT_S_DN
ssl_client_verify_header = SSL_CLIENT_VERIFY

Actually, I m trying to find where I should set my master information inside of the agent ? How can my agent connect to the master in this file ?

I didn't find anything great concerning this in the documentation...

Can you help me ?

3

3 Answers

3
votes

You need an agent block. Something similar to the following:

You can run puppet agent --genconfig to know about other attributes.

[agent]
# The server to which puppet agent should connect 
server = mypuppet.server.org

# The file in which puppetd stores a list of the classes
# associated with the retrieved configuratiion.  Can be loaded in
# the separate ``puppet`` executable using the ``--loadclasses``
# option.
# The default value is '$confdir/classes.txt'.
classfile = $vardir/classes.txt

# Where puppetd caches the local configuration.  An
# extension indicating the cache format is added automatically.
# The default value is '$confdir/localconfig'.
localconfig = $vardir/localconfig

# How often puppet agent applies the client configuration; in seconds.
# Note that a runinterval of 0 means "run continuously" rather than
# "never run." If you want puppet agent to never run, you should start
# it with the `--no-client` option.
# The default value is '1800'.
runinterval = 86400
1
votes

My /etc/puppet/puppet.conf had this in it:

[agent]
    # The file in which puppetd stores a list of the classes
    # associated with the retrieved configuratiion.  Can be loaded in
    # the separate ``puppet`` executable using the ``--loadclasses``
    # option.
    # The default value is '$confdir/classes.txt'.
    classfile = $vardir/classes.txt

    # Where puppetd caches the local configuration.  An
    # extension indicating the cache format is added automatically.
    # The default value is '$confdir/localconfig'.
    localconfig = $vardir/localconfig

and I simply added this one line after localconfig

server = host.fq.dn.com
0
votes

There is no require to change in puppet.conf for puppet master.

You need add puppet in your DNS, that you can run nslookup puppet to get its IP address

If you don't have dns servers, then you should add it in each puppet agent's local /etc/hosts, for example

10.0.0.4 puppet puppet.example.com

After that, when you run puppet agent -t, the agent will automatically communicate with the server puppet.

Note: make sure the firewalls are opened between puppet agent and master server.