[英]Puppet 4.10.4: Master not reading manifest
So I've started to try and use puppet, and I thought i had configured correctly as the node will successfully connect to the master: 因此,我开始尝试使用up,并且我认为我已经正确配置了,因为该节点将成功连接到主节点:
C:\Windows\system32>puppet agent -t
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Info: Caching catalog for node.mydomain.com
Info: Applying configuration version '1502092203'
Notice: Applied catalog in 0.06 seconds
However, i have made changes to the master via the site.pp by simply adding the helloworld module: 但是,我仅通过添加helloworld模块即可通过site.pp对主服务器进行了更改:
node default {
class { 'helloworld': }
}
with this code: 使用此代码:
class helloworld {
notify { 'hello, world!':}
}
this works if i call the site.pp explicitly on the master: 如果我在主服务器上显式调用site.pp,则此方法有效:
puppetmaster3@192:~$ sudo puppet apply
/etc/puppetlabs/code/environments/production/manifests/site.pp
[sudo] password for puppetmaster3:
Notice: Compiled catalog for 192.168.1.23 in environment production in 0.15 seconds
Notice: hello, world!
Notice: /Stage[main]/Helloworld/Notify[hello, world!]/message: defined 'message' as 'hello, world!'
Notice: Applied catalog in 0.05 seconds
however when i try to verify it it cannot be found as it "doesn't exist": 但是,当我尝试验证它时,找不到它,因为它“不存在”:
puppetmaster3@192:~$ puppet parser validate site.pp
Error: One or more file(s) specified did not exist:
[" site.pp\n"]
Error: Try 'puppet help parser validate' for usage
When i run puppet agent on the node, it doesn't pick up the helloworld as shown orignally 当我在节点上运行puppet agent时,它没有按照原始显示的方式拾取helloworld
I haven't edited the puppet.conf to or environment.conf to specify a manifest as I've used the default locations, do i need to declare them in puppet.conf? 我没有将puppet.conf编辑为or environment.conf以指定清单,因为我使用了默认位置,是否需要在puppet.conf中声明它们? because if i try and print the manifest it comes up with this: 因为如果我尝试打印清单,它将出现以下问题:
puppetmaster3@192:~$ puppet config print manifest
no_manifest
The puppet parser validate
command could be a little more helpful in its responses, but usage is: puppet parser validate
命令可能会对响应有所帮助,但是用法是:
$ puppet parser validate --help
USAGE: puppet parser validate [<manifest>] [<manifest> ...]
This action validates Puppet DSL syntax without compiling a catalog or
syncing any resources. If no manifest files are provided, it will
validate the default site manifest.
RETURNS: Nothing, or the first syntax error encountered.
OPTIONS:
--render-as FORMAT - The rendering format to use.
--verbose - Whether to log verbosely.
--debug - Whether to log debug information.
See 'puppet man parser' or 'man puppet-parser' for full help.
So you can do this: 因此,您可以执行以下操作:
$ bundle exec puppet parser validate /Users/alexharvey/.puppetlabs/etc/code/environments/production/manifests/site.pp
$
(No response at all means all-OK.) (完全没有响应意味着一切正常。)
Or you can do this: 或者您可以这样做:
$ puppet parser validate
Notice: No manifest specified. Validating the default manifest /Users/alexharvey/.puppetlabs/etc/code/environments/production/manifests
It just validated /Users/alexharvey/.puppetlabs/etc/code/environments/production/manifests/site.pp. 它只是验证了/Users/alexharvey/.puppetlabs/etc/code/environments/production/manifests/site.pp。 That's because I'm running as a non-privileged user and my modulepath
is: 这是因为我以非特权用户身份运行,而我的modulepath
为:
$ puppet config print modulepath
/Users/alexharvey/.puppetlabs/etc/code/environments/production/modules:/Users/alexharvey/.puppetlabs/etc/code/modules:/opt/puppetlabs/puppet/modules
You are getting that failure because you didn't specify a full path, and there is no such file site.pp
in the current directory. 之所以失败,是因为您没有指定完整路径,并且当前目录中没有此类文件site.pp
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.