Puppet和Agent配置

时间:2015-09-29 14:20:57

标签: puppet

我实际上是想从Puppet创建一个Agent,我遇到了一个问题。

事实上,我在我的代理中生成了标准生成的puppet.conf文件,其全局如下:

[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

实际上,我试图找到我应该在代理中设置主信息的位置?我的代理如何连接到此文件中的主服务器?

我在文档中没有发现任何关于这个的好消息......

你能帮助我吗?

3 个答案:

答案 0 :(得分:3)

你需要一个代理块。类似于以下内容:

您可以运行puppet agent --genconfig来了解其他属性。

[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 :(得分:1)

我的/etc/puppet/puppet.conf中有这个:

[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

我只是在localconfig

之后添加了这一行
server = host.fq.dn.com

答案 2 :(得分:0)

没有要求改变木偶大师的puppet.conf

您需要在DNS中添加puppet,以便运行nslookup puppet以获取其IP地址

如果你没有dns服务器,那么你应该在每个木偶代理的本地/etc/hosts中添加它,例如

10.0.0.4 puppet puppet.example.com

之后,当您运行puppet agent -t时,代理将自动与服务器puppet通信。

注意:确保在puppet代理和主服务器之间打开防火墙。