tst-01 上的 Puppet 在使用时可以正常工作:
node "tst-01" inherits basenode {
但是当我尝试使用这种配置将服务器组织成组时它会中断:
node "tst-01" inherits redhat6server {
“继承 redhat6server”的错误是:
err: Could not retrieve catalog; skipping run
[root@tst-01 ~]# puppet agent --test
err: Could not retrieve catalog from remote server: Error 400 on SERVER: Failed to parse template ldap/access.conf: Could not find value for 'netgroup' at 124:/etc/puppet/modules/ldap/templates/access.conf at /etc/puppet/modules/ldap/manifests/init.pp:82 on node tst-01.tst.it.test.com
warning: Not using cache on failed catalog
err: Could not retrieve catalog; skipping run
这是access.conf 文件,如果inherits 设置为“inherits basenode”,它可以正常工作。
[root@puppet]# grep -v "#" /etc/puppet/modules/ldap/templates/access.conf
+ : root : LOCAL
+ : @<%= netgroup %> : ALL
- : ALL : ALL
[root@puppet]#
这是 /etc/puppet/manifests/nodes.pp 中的配置。
# Basenode configuration
node "basenode" {
include resolv_conf
include sshd
include ntpd
include motd
}
# Groups
node "redhat6server" inherits basenode {
include ldap_auth
}
# Testservers
node "tst-01" inherits redhat6server {
$netgroup = tst-01
}
我计划通过对机器(例如 RH5 和 RH6 机器)进行分组,而不是为所有 RH5 和 RH6 服务器添加多行包含内容,从而在 nodes.pp 中带来更多的组织(阅读:避免配置重复)。