工头与puppet node.rb错误404未找到

我已经安装了带有木偶的foreman-1.2 ,安装完成后我已将我的木偶注册到工smart-proxy

当我运行以下命令

 [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调试

 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概念

首先,您应该检查node.rb的内容。 需要设置许多变量才能使其工作。 看起来这还没有完成,因为“Net :: HTTPNotFound”说它无法找到你的Foreman服务器。

第二,是和否 – 首先需要在Froreman中定义主机。 如果主持人在Foreman中不存在而Foreman“可能”创建它 – 它实际上取决于你如何设置Foreman。

如果内存服务正常,我相信当node.rb上传事实时,将创建一个不存在的主机(如果已启用)。 如果您只是从命令行运行它,则不会上载任何事实并且未创建主机。

为了进行测试,请确保在Foreman中创建主机。 然后测试node.rb(在检查其中的vars设置正确后)。

编辑:你是最后一个问题:node.rb的主要function是获取服务器的yaml格式化配置并将其交给puppet。 辅助它还用于将事实从服务器上传到Foreman – 可用于对Foreman中的服务器进行分类。

基本上,您必须确保主服务器和代理程序彼此熟悉(通过/ etc / hosts或dns)。 当主服务器无法解析代理的名称时,通常会引发此错误(例如puppet.example.com)