Puppet 4.2 Puppet代理仅在主机重新启动后获取更改

Puppet 4.2 Puppet代理仅在主机重新启动后获取更改,puppet,Puppet,简言之,对site.pp的更改仅在puppet master重新启动后反映在代理上 这应该是在单独的主机和节点VM上进行OOTB安装,配置更改最少(基本上是dns_alt_名称和/etc/hosts+证书)。主节点和节点之间没有通信问题 关于我的主人我有一份档案, /etc/puppetlabs/code/environments/production/manifests/site.pp 包含: node "slave1.home" { user { "kevin": ens

简言之,对site.pp的更改仅在puppet master重新启动后反映在代理上

这应该是在单独的主机和节点VM上进行OOTB安装,配置更改最少(基本上是dns_alt_名称和/etc/hosts+证书)。主节点和节点之间没有通信问题

关于我的主人我有一份档案, /etc/puppetlabs/code/environments/production/manifests/site.pp 包含:

 node "slave1.home" {
   user { "kevin":
      ensure     => present,
      membership => minimum,
      shell      => "/bin/bash",
   }

 }
在代理节点上运行puppet agent-t后(捕获只在主节点重新启动后进行),更改将受到影响。我可以看到一个文件已从主节点传输到我所在位置的代理节点, /opt/puppetlabs/puppet/cache/client_data/catalog/slave1.home.json 其中包含用户“kevin”的详细信息,用户已成功创建

如果我在puppet master上更改site.pp(例如,用户现在是“kevino22y”),那么我(可能是错误地)尝试为节点slave1.home进行编译

e、 g

puppet master--编译slave1.home

在终点站我看到了

Notice: Compiled catalog for slave1.home in environment production in 0.28 seconds
{
  "tags": ["settings","slave1.home","node"],
  "name": "slave1.home",
  "version": 1436006611,
  "environment": "production",
  "resources": [
  {
      "type": "Stage",
      "title": "main",
      "tags": ["stage"],
      "exported": false,
      "parameters": {
      "name": "main"
  }
  },
  {
      "type": "Class",
      "title": "Settings",
      "tags": ["class","settings"],
      "exported": false
  },
  {
      "type": "Class",
      "title": "main",
      "tags": ["class"],
      "exported": false,
      "parameters": {Notice: Compiled catalog for slave1.home in environment        production in 0.28 seconds
{
  "tags": ["settings","slave1.home","node"],
  "name": "slave1.home",
  "version": 1436006611,
  "environment": "production",
  "resources": [
    {
      "type": "Stage",
      "title": "main",
      "tags": ["stage"],
      "exported": false,
      "parameters": {
         "name": "main"
      }
    },
    {
      "type": "Class",
      "title": "Settings",
      "tags": ["class","settings"],
      "exported": false
    },
   {
     "type": "Class",
     "title": "main",
     "tags": ["class"],
     "exported": false,
     "parameters": {
      "name": "main"
    }
   },
   {
      "type": "Node",
      "title": "slave1.home",
      "tags": ["node","slave1.home","class"],
      "exported": false
    },
    {
      "type": "User",
      "title": "kevino22y",
      "tags": ["user","kevino22y","node","slave1.home","class"],
      "file":      "/etc/puppetlabs/code/environments/production/manifests/site.pp",
      "line": 2,
      "exported": false,
      "parameters": {
      "ensure": "present",
      "membership": "minimum",
      "shell": "/bin/bash"
     }
   }
  ],
  "edges": [
    {
     "source": "Stage[main]",
     "target": "Class[Settings]"
   },
   {
     "source": "Stage[main]",
     "target": "Class[main]"
   },
   {
     "source": "Class[main]",
     "target": "Node[slave1.home]"
   },
   {
     "source": "Node[slave1.home]",
     "target": "User[kevino22y]"
   }
 ],
 "classes": [
   "settings",
   "slave1.home"
 ]
}
如果我回到我的仆人家里跑, 傀儡特工-t

我看到了原件的新副本 /opt/puppetlabs/puppet/cache/client_data/catalog/slave1.home.json 与原始的“kevin”用户一起使用,因此我希望在编译后出现的更改不存在

因此,代理的获取过程似乎很好,但获取的是过时的信息。 它只有在我停止并启动puppet master服务时才会刷新,而不是在编译之后

因此,我似乎还没有执行一个步骤,这个步骤是通过重新启动puppet主进程来执行的

如果有人告诉我错过了什么,我可能会自责。 谢谢你对新手问题的帮助

凯文

---编辑---

仍在尝试诊断并添加新服务器(名为cs1的代理)

如果我: [root@cs1桌面]#傀儡代理-t 信息:检索插件影响 信息:检索插件 信息:缓存cs1.home的目录 信息:正在应用配置版本“1436032639” 注意:0.02秒后应用目录 [root@cs1桌面]#

然后在主机上使用: puppet master--无daemonize--调试>/tmp/master.txt 跟踪日志

Debug: Routes Registered:
Debug: Route /^\/puppet\//
Debug: Route /^\/puppet-ca\//
Debug: Route /.*/
Debug: Evaluating match for Route /^\/puppet\//
Debug: Evaluating match for Route /v3/
Debug: Evaluating match for Route /^\/environments$/
Debug: Did not match path ("/node/cs1.home")
Debug: Evaluating match for Route /.*/
Info: Caching node for cs1.home
Debug: Puppet::Network::Format[msgpack]: feature msgpack is missing
Debug: node supports formats: pson yaml binary
Debug: Routes Registered:
Debug: Route /^\/puppet\//
Debug: Route /^\/puppet-ca\//
Debug: Route /.*/
Debug: Evaluating match for Route /^\/puppet\//
Debug: Evaluating match for Route /v3/
Debug: Evaluating match for Route /^\/environments$/
Debug: Did not match path ("/file_metadatas/pluginfacts")
Debug: Evaluating match for Route /.*/
Debug: Warning: calling Plugins.search with empty module path.
Debug: Puppet::Network::Format[msgpack]: feature msgpack is missing
Debug: file_metadata supports formats: pson yaml binary
Debug: Routes Registered:
Debug: Route /^\/puppet\//
Debug: Route /^\/puppet-ca\//
Debug: Route /.*/
Debug: Evaluating match for Route /^\/puppet\//
Debug: Evaluating match for Route /v3/
Debug: Evaluating match for Route /^\/environments$/
Debug: Did not match path ("/file_metadatas/plugins")
Debug: Evaluating match for Route /.*/
Debug: Warning: calling Plugins.search with empty module path.
Debug: Puppet::Network::Format[msgpack]: feature msgpack is missing
Debug: file_metadata supports formats: pson yaml binary
Debug: Routes Registered:
Debug: Route /^\/puppet\//
Debug: Route /^\/puppet-ca\//
Debug: Route /.*/
Debug: Evaluating match for Route /^\/puppet\//
Debug: Evaluating match for Route /v3/
Debug: Evaluating match for Route /^\/environments$/
Debug: Did not match path ("/catalog/cs1.home")
Debug: Evaluating match for Route /.*/
Info: Caching node for cs1.home
Notice: Compiled catalog for cs1.home in environment production in 0.00 seconds
Debug: Puppet::Network::Format[msgpack]: feature msgpack is missing
Debug: catalog supports formats: pson yaml dot binary
Debug: Routes Registered:
Debug: Route /^\/puppet\//
Debug: Route /^\/puppet-ca\//
Debug: Route /.*/
Debug: Evaluating match for Route /^\/puppet\//
Debug: Evaluating match for Route /v3/
Debug: Evaluating match for Route /^\/environments$/
Debug: Did not match path ("/report/cs1.home")
Debug: Evaluating match for Route /.*/
Debug: Received report to process from cs1.home
Debug: Processing report from cs1.home with processor Puppet::Reports::Store
我不完全确定“.home”是从哪里来的。我在互联网上看到它可能是由家庭路由器(?)安装的,但我的fqdn的格式是cs1.localdomain,但/etc/hosts包含xxx.xxx.xxx cs1.localdomain cs1.home

--编辑2--

仅供参考,当运行puppet agent-t时,我从服务器上收到5个文件,这些文件不反映已编译的更改

[root@cs1桌面]#find/opt/puppetlabs/-type f-mmin-3-execls-al{}; -rw rw----1 root root 1290 Jul 6 14:56/opt/puppetlabs/puppet/cache/client_data/catalog/cs1.home.json -rw-r-----1 root根7628 Jul 6 14:56/opt/puppetlabs/puppet/cache/state/last_run_report.yaml -rw-r-----1根根根目录29 Jul 6 14:56/opt/puppetlabs/puppet/cache/state/resources.txt -rw-r--r--1根根根407 Jul 6 14:56/opt/puppetlabs/puppet/cache/state/last_run_summary.yaml -rw rw----1根根目录3655 Jul 6 14:56/opt/puppetlabs/puppet/cache/state/state.yaml
-rw-r-----1 root root 7月18日6日14:56/opt/puppetlabs/puppet/cache/state/classes.txt发生此情况的原因是对puppet主机上的网络配置进行了更改。已重新启动网络服务并手动验证更改(例如主机名和对/etc/hosts的更改)。解决方案只是重新启动傀儡主机。

问题: 当我们在environment=production下进行更改时,我们始终必须重新启动puppet master,否则将无法选择新的更改

为什么?因为在puppet master/etc/puppet/puppet.conf环境中,超时=无限。 如果要更改此行为,必须将环境\u timeout设置为0

关于环境\u超时=无限 此设置指定puppet master将缓存目录,它的存在是为了提高性能

但在测试环境中,我们通常希望看到我们的更改立即得到应用

要做到这一点,在木偶大师身上做两件事

  • 在环境目录下创建environment.conf,例如/etc/puppet/environment/TEST

  • 添加环境\u超时=0

  • 在puppet客户端(您要应用目录的地方)上执行此操作

  • puppet代理-t--environment=TEST
  • 您将看到您的更改已应用

    线程帮助我找到了解决方案

    (a) 环境配置:

    编辑清单后,您要等多久?我可以留一晚。因为我只是在测试,所以我将频率设置为5米。因为我只是在测试,所以我可以留一晚。我将频率设置为5米。我只是将它改为30秒(30秒,看看是否有区别)但没有效果。编译写入标准输出,但它也必须重定向到一个文件,以便在主机重新启动时对其进行处理。这可能是一个问题吗?我也有同样的问题,你能找到解决方案吗?几天来,我的头撞在墙上,即使在nodes.pp或site.pp中添加通知,我仍然无法将其应用到我的测试主机,直到我重新启动我的傀儡主机