问题描述
我已经将foreman-1.2
与木偶一起安装,安装后我已将我的木偶注册到领班上的smart-proxy
.
I have installed foreman-1.2
with puppet, after installation i have registered my puppet to smart-proxy
on foreman.
当我运行以下命令时
[root@puppet ~]# puppet agent -t
Warning: Unable to fetch my node definition, but the agent run will continue:
Warning: Error 400 on SERVER: Failed to find puppet.example.com via exec: Execution of '/etc/puppet/node.rb puppet.example.com' returned 1: --- false
Info: Retrieving plugin
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Failed when searching for node puppet.example.com: Failed to find puppet.example.com via exec: Execution of '/etc/puppet/node.rb puppet.example.com' returned 1: --- false
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run
我尝试关注
[root@puppet ~]# /etc/puppet/node.rb puppet.example.com
--- false
Error retrieving node puppet.example.com: Net::HTTPNotFound
foreman.log调试
foreman.log debug
Started GET "/node/puppet.example.com?format=yml" for 10.101.20.15 at 2014-03-25 21:01:47 -0400
Processing by HostsController#externalNodes as YML
Parameters: {"name"=>"puppet.example.com"}
Setting Load (1.3ms) SELECT `settings`.* FROM `settings` WHERE `settings`.`name` = 'restrict_registered_puppetmasters' ORDER BY name LIMIT 1
Setting Load (0.3ms) SELECT `settings`.* FROM `settings` WHERE `settings`.`name` = 'require_ssl_puppetmasters' ORDER BY name LIMIT 1
SmartProxy Load (0.5ms) SELECT `smart_proxies`.* FROM `smart_proxies` INNER JOIN `features_smart_proxies` ON `features_smart_proxies`.`smart_proxy_id` = `smart_proxies`.`id` INNER JOIN `features` ON `features`.`id` = `features_smart_proxies`.`feature_id` WHERE `features`.`name` = 'Puppet' ORDER BY smart_proxies.name
Setting Load (0.3ms) SELECT `settings`.* FROM `settings` WHERE `settings`.`name` = 'trusted_puppetmaster_hosts' ORDER BY name LIMIT 1
Verifying request from ["puppet.example.com"] against ["puppet.example.com"]
User Load (0.4ms) SELECT `users`.* FROM `users` WHERE `users`.`login` = 'admin' LIMIT 1
Setting current user thread-local variable to admin
Host::Managed Load (0.7ms) SELECT `hosts`.* FROM `hosts` WHERE `hosts`.`type` IN ('Host::Managed') AND `hosts`.`certname` = 'puppet.example.com' LIMIT 1
Host::Managed Load (0.6ms) SELECT `hosts`.* FROM `hosts` WHERE `hosts`.`type` IN ('Host::Managed') AND `hosts`.`name` = 'puppet.example.com' LIMIT 1
Completed 404 Not Found in 25ms (ActiveRecord: 4.1ms)
我想念什么吗?我需要首先在foreman
GUI上创建主机吗?我不明白node.rb
Am i missing something? do i need to create host first on foreman
GUI? I don't understand concept of node.rb
推荐答案
首先,您应该检查node.rb的内容.要使其正常工作,需要设置许多变量.似乎尚未完成,因为"Net :: HTTPNotFound"表示找不到您的Foreman服务器.
First you should check the contents of node.rb. There are a number of variables that need to be set for it to work. It looks like this hasn't been done because the "Net::HTTPNotFound" says it can't find your Foreman server.
第二,是和否-首先需要在Froreman中定义主机.如果主持人在Foreman中不存在,而Foreman可以创建"它,则实际上取决于您如何设置Foreman.
Second, yes and no -- the host needs to be defined in Froreman first. If the host doesn't exist in Foreman yet Foreman "may" create it -- it really depends on how you've set up Foreman.
如果内存正常工作,我相信由node.rb上传事实时会创建一个不存在的主机(如果启用).如果您只是从命令行运行它,则不会上传任何事实,也不会创建主机.
If memory serves properly, I believe a non-existent host will be created when the facts are uploaded by node.rb (if that is enabled). If you're just running it from the command line, then no facts are being uploaded and the host isn't being created.
为进行测试,请确保在Foreman中创建了主机.然后测试node.rb(检查其中的var是否设置正确之后).
For your testing, ensure the host is created in Foreman. Then test node.rb (after you check that the vars in it are set properly).
您最后一个问题:node.rb的主要功能是获取服务器的yaml格式的配置,并将其交给人偶.其次,它还具有将事实从服务器上载到Foreman的功能-可用于在Foreman中对服务器进行分类.
You're last question: node.rb's main function is to get the yaml formated config for a server and hand it to puppet. Secondary it also functions to upload facts from the server to Foreman -- which can be used in classifying the server in Foreman.
这篇关于工头与木偶node.rb错误404未找到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!