Foreman作品中的“Run Puppet”function不一致

首先,快速浏览我们的设置:

  1. 我们有一个Foreman实例正常运行,我们称之为工头
  2. 木偶大师运作良好,我们称之为木偶大师。
  3. 有两个主持人可以从领class和傀儡大师联系,没有防火墙,我们称之为host-a和host-b。
  4. 所有主机都运行3.x

我们已经开始扩展我们对Foreman的使用,并且想要启用Run Puppetbutton。 我跟着维基,并在最初的testing中得到了它的工作。 但是,在进一步的testing中,button产生了一些非常不一致的结果。 我似乎还记得,在触发运行中,默认情况下有2分钟的弹幕,但这不是问题。 有时候,当我点击button时,一个主机跳跃并立即开始运行。 但是大多数情况下,它永远不会触发一次运行。

工头在sudoersconfiguration中有以下内容:

Defaults:foreman-proxy !requiretty foreman-proxy ALL = NOPASSWD: /usr/bin/puppet kick * 

主机在auth.conf中包含以下内容:puppet.conf中的空白namespaceauth.conf和listen = true。

 # allow foreman to start puppet runs path /run auth any method save allow foreman.domain.lan 

当试图通过工头触发一个Puppet运行时,这个出现在生产日志中。

 Started GET "/hosts/host-a.domain.lan/puppetrun" for 192.168.8.48 at 2014-07-15 21:44:59 +0000 Processing by HostsController#puppetrun as HTML Parameters: {"id"=>"host-a.domain.lan"} Redirected to http://foreman.domain.lan/hosts/host-a.domain.lan Completed 302 Found in 48ms (ActiveRecord: 1.3ms) Started GET "/hosts/host-a.domain.lan" for 192.168.8.48 at 2014-07-15 21:44:59 +0000 Processing by HostsController#show as HTML Parameters: {"id"=>"host-a.domain.lan"} Rendered hosts/_overview.html.erb (16.2ms) Rendered hosts/_metrics.html.erb (0.3ms) Rendered hosts/show.html.erb within layouts/application (734.1ms) Rendered home/_user_dropdown.html.erb (2.0ms) Read fragment views/tabs_and_title_records-2 (0.2ms) Rendered home/_topbar.html.erb (3.8ms) Rendered layouts/base.html.erb (5.9ms) Completed 200 OK in 781ms (Views: 652.3ms | ActiveRecord: 108.6ms) 

就这一点而言,Puppet偶尔会在主机上触发,但并不总是如此。 有任何想法吗?

编辑:我应该补充说,当运行触发器不成功,当运行木偶代理主机端没有消息 – no-daemonize –debug

MOAR EDIT:在主持人和领classv3.3.1上运行Foreman v1.5.1加上Puppet 3.6.2。

我尝试了很多方法来让脚跑得稳稳,但是不能,反正也不推荐,于是我转到了puppetssh。 这需要configuration智能代理的SSH密钥,工头代理用户及其sudo权限。 在这个puppet运行方法中没有太多的文档,foreman-proxy中的DEBUG日志logging不包含任何命令输出,所以很难判断哪里/哪些地方失败了。

默认情况下,foreman-proxy用户没有shell(在RHEL上)并且不能运行/ usr / bin / ssh。 一个简单的usermod -s / bin / bash做了这个窍门,但是这对我来说似乎是一个安全风险。 最重要的是,不同的sudo权限是必要的,所以我必须改变foreman-proxy ALL = NOPASSWD:/ usr / bin / puppet kickforeman-proxy ALL = NOPASSWD:/ usr / bin / ssh 。 之后,这只是一个configurationssh命令的问题。

就我而言,我们部署了一个用户帐户和SSH密钥,用于在客户机上使用sudo运行Puppet命令。 我将私钥复制到了foreman-proxy可以使用的地方(如:/ etc / foreman-proxy / puppetssh / id_rsa),并在/etc/foreman-proxy/settings.yml中configurationpuppetssh参数,如下所示:

 :puppetssh_command: /usr/bin/sudo /usr/bin/puppet agent -t --no-usecacheonfailure :puppetssh_user: puppetssh :puppetssh_keyfile: /etc/foreman-proxy/puppetssh/id_rsa 

它为我工作我selectpuppetssh来源http://theforeman.org/manuals/1.11/index.html#4.3.6Puppet

从内容puppetssh的上面的链接中遵循这一条指令,现在编辑文件中的以下行。

 /etc/foreman-proxy/settings.d/puppet. 

:puppetssh_command: /usr/bin/puppet agent --onetime --no-usecacheonfailure

将其转换为

:puppetssh_command: /usr/bin/puppet agent --test

现在它会像魅力一样自由地回复,如果它不起作用欢呼声