【问题标题】:Foreman with puppet node.rb error 404 Not Found工头与 puppet node.rb 错误 404 Not Found
【发布时间】:2014-03-26 01:08:02
【问题描述】:

我已经用 puppet 安装了foreman-1.2,安装后我已经在工头上注册了我的 puppet 到 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 的概念

【问题讨论】:

    标签: ruby puppet theforeman


    【解决方案1】:

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

    其次,是和否——首先需要在Froreman 中定义主机。如果主机在 Foreman 中不存在,但 Foreman “可以”创建它 - 这实际上取决于您如何设置 Foreman。

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

    为了您的测试,请确保主机是在 Foreman 中创建的。然后测试 node.rb (检查其中的变量是否设置正确之后)。

    编辑: 你是最后一个问题:node.rb 的主要功能是获取服务器的 yaml 格式配置并将其交给 puppet。其次,它还具有将事实从服务器上传到 Foreman 的功能——这可用于在 Foreman 中对服务器进行分类。

    【讨论】:

      【解决方案2】:

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

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2019-05-12
        • 1970-01-01
        • 1970-01-01
        • 2021-12-18
        • 2017-09-03
        • 2015-01-14
        • 2013-03-10
        • 1970-01-01
        相关资源
        最近更新 更多