Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby 当存在不同的错误时,如何让Puppet Master针对Puppet代理节点运行清单?_Ruby_Linux_Networking_Ssh_Puppet - Fatal编程技术网

Ruby 当存在不同的错误时,如何让Puppet Master针对Puppet代理节点运行清单?

Ruby 当存在不同的错误时,如何让Puppet Master针对Puppet代理节点运行清单?,ruby,linux,networking,ssh,puppet,Ruby,Linux,Networking,Ssh,Puppet,我在一个网络中设置了一个傀儡主机和傀儡代理服务器。我已从puppet主服务器签署puppet代理的证书请求。我正试图对Puppet代理服务器运行Puppet Master的清单,但失败了。两个Puppet主服务器上的newManifest.pp通过其FQDN调用Puppet代理。两台服务器上的/etc/hosts文件包含两台服务器的FQDN及其IP地址的条目。我可以从其他服务器ping每个服务器。我可以使用SSH从每台服务器连接到另一台服务器 这两个网络中的所有四台服务器都使用CentOS 7作

我在一个网络中设置了一个
傀儡主机和傀儡代理服务器。我已从puppet主服务器签署puppet代理的证书请求。我正试图对Puppet代理服务器运行Puppet Master的清单,但失败了。两个Puppet主服务器上的
newManifest.p
p通过其FQDN调用Puppet代理。两台服务器上的
/etc/hosts
文件包含两台服务器的FQDN及其IP地址的条目。我可以从其他服务器ping每个服务器。我可以使用SSH从每台服务器连接到另一台服务器

这两个网络中的所有四台服务器都使用
CentOS 7
作为开源
Puppet版本3.8.4
的操作系统。所有四台机器上的防火墙都已关闭。这些端口在Puppet主服务器和Puppet代理服务器之间的任何网络上的任何中间路径22、443、8140和61610上都不会被阻塞

在网络一中,我希望编译清单。他们从来没有

我用sshd_config`尝试了这一点,在Puppet Master和Puppet agent上使用端口22、443、8140和61610。当我从木偶大师那里使用它时:

puppet agent -t newManifest.pp --server='foobar.acme.com'
我得到一个错误:

Unable to fetch my node definition, but the agent will continue: Warning: Connection refused - connect(2).
我再次尝试使用sshdconfig,不专门使用任何端口。我回收了sshdconfig服务。我运行相同的命令:

puppet agent -t newManifest.pp --server='foobar.acme.com'
puppet agent -t newManifest.pp --server='foobar.acme.com'
puppet agent -t newManifest.pp --server='foobar.acme.com'
我得到一个不同的错误:

Unable to fetch my node definition, but the agent run will continue: connection refused - connect(2).
   Unable to fetch my node definition, but the agent run will continue: SSL_connect returned=1 errno=0 state=SSLv2/v3 read server hello A: unknown protocol.
 Unable to fetch my node definition, but the agent run will continue: connection refused - connect(2).
然后我尝试了这个命令(没有明确的服务器名称):

这一次,我得到了这个错误:

Unable to fetch my node definition, but the agent will continue: Network is unreachable.
 Unable to fetch my node definition, but the agent will continue: No route to host - connect(2).
在第二网络中,我希望清单能够起作用。他们从来没有

我用sshd_config尝试了这个方法,在Puppet Master和Puppet agent上使用端口22、443、8140和61610。当我从木偶大师那里使用它时:

puppet agent -t newManifest.pp --server='foobar.acme.com'
我得到一个不同的错误:

Unable to fetch my node definition, but the agent run will continue: connection refused - connect(2).
   Unable to fetch my node definition, but the agent run will continue: SSL_connect returned=1 errno=0 state=SSLv2/v3 read server hello A: unknown protocol.
 Unable to fetch my node definition, but the agent run will continue: connection refused - connect(2).
我再次尝试使用sshdconfig,不专门使用任何端口。我回收了sshdconfig服务。我运行相同的命令:

puppet agent -t newManifest.pp --server='foobar.acme.com'
puppet agent -t newManifest.pp --server='foobar.acme.com'
puppet agent -t newManifest.pp --server='foobar.acme.com'
我得到一个不同的错误:

Unable to fetch my node definition, but the agent run will continue: connection refused - connect(2).
   Unable to fetch my node definition, but the agent run will continue: SSL_connect returned=1 errno=0 state=SSLv2/v3 read server hello A: unknown protocol.
 Unable to fetch my node definition, but the agent run will continue: connection refused - connect(2).
然后我尝试了这个命令(没有明确的服务器名称):

这一次,我得到了这个错误:

Unable to fetch my node definition, but the agent will continue: Network is unreachable.
 Unable to fetch my node definition, but the agent will continue: No route to host - connect(2).
网络1和网络2之间的错误不同,除非sshd_config未使用任何特定端口,并且编译清单的命令显式设置FQDN。为什么会这样?怎么了?我试过两次设置Puppet,只是为了修复第一个实例。我无法完全重现第一个网络中的具体问题


如何让Puppet主服务器编译清单?傀儡特工已经签署了证书。我不明白为什么清单的编译总是失败。

您至少有两组完全不同的问题

首先,正如@daxelrod所评论的那样,傀儡代理不是这样工作的。主/代理模式的要点是,主节点决定节点的配置应该是什么。此外,船长不向代理人提供舱单文件;相反,它会评估为代理应用构建资源“目录”所需的任何清单和数据。大师服务的就是这些目录

如果希望代理在任何给定运行中仅应用其部分配置,则可以使用
--tags
选项指示它从其目录中选择资源的特定子集。可以在清单中手动指定可供选择的标记,Puppet会根据资源的声明位置自动使用类名段标记资源,但这并不会沿着清单文件的行清晰地分解

如果您确实希望将特定清单文件应用于您的计算机,那么这些清单文件及其依赖的任何数据或资源必须存在于目标计算机上。在这种情况下,您可以使用
puppet apply
而不是@daxelrod观察到的使用代理


第二,关于你的网络问题,如果确实存在的话

所有四台机器上的防火墙都已关闭。这些端口在Puppet主服务器和Puppet代理服务器之间的任何网络上的任何中间路径22、443、8140和61610上都不会被阻塞

正如您所说,对于代理报告的“连接被拒绝”故障,我能看到的唯一其他合理解释是,puppetmaster实际上没有在代理尝试连接的机器上运行,至少没有在代理尝试连接的端口上运行。这可能是因为某种类型的名称解析问题(即“foobar.acme.com”的解析方式与您预期的不同),也可能是因为主机配置为在与您想象的不同的端口上侦听,或者仅仅是因为您没有成功启动它

“网络不可访问”似乎更易于诊断:如果未通过命令行为代理指定服务器,并且未在代理的配置文件中配置服务器,则Puppet将尝试连接到名为“Puppet”的计算机。这是为您解析无法访问的网络上的地址。(如果代理根本无法解析名称,则消息会有所不同。)

真正有趣的错误消息是SSL握手错误:

SSL_connect返回=1 errno=0 state=SSLv2/v3读取服务器hello A:未知协议

在这种情况下,客户端已成功连接并尝试启动SSL握手序列,但它无法理解来自服务器的响应。这很可能意味着服务器根本没有向客户机讲SSL,但我无法猜测它在讲什么


此外,您在问题中多次提到
sshd\u config
,似乎这与问题有关。但是,除非您正在做一些非常不寻常的事情,否则无论是
sshd
还是它的任何配置文件都不会参与Puppet运行


总的来说,我倾向于认为你正在处理一系列错误的期望,对主要系统的理解不足