Search code examples
puppet

Puppet 4.2 puppet agent only gets changes after master restarted


In short, changes to site.pp are only reflected on agents after the puppet master has been restarted.

This is supposed to be an OOTB install on separate master and node VM's with minimal config changes - basically dns_alt_names and /etc/hosts + certificates). There are no coms issues between master and node.

On my master I have a file, /etc/puppetlabs/code/environments/production/manifests/site.pp containing:

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

 }

After running puppet agent -t on the agent node (and the catch is only after the master has been restarted) the change is affected. I can see a file has been transferred from the master to my agent node in the location, /opt/puppetlabs/puppet/cache/client_data/catalog/slave1.home.json which contains the details of the user 'kevin' and the user is successfully created.

If I change site.pp on the puppet master (e.g. so the user is now "kevino22y", for example. I then (probably wrongly) try to compile for the node slave1.home

e.g.

puppet master --compile slave1.home

On the terminal I see

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"
 ]
}

If I then return to my slave1.home and run, puppet agent -t

I see a new copy of the original /opt/puppetlabs/puppet/cache/client_data/catalog/slave1.home.json with the original 'kevin' user so changes that I expected to appear after compiling are not there.

So it seems that the agent's fetching process is good but fetches outdated info. It only refreshes if I stop and start the puppet master service - not after compiling.

So it further seems I am missing executing a step which is executed by the restarting of the puppet master process.

Probably going to kick myself when someone tells me what I have missed. Thanks for the help with the newbie question.

Kevin

---edit ---

Still trying to diagnose and added a new server (agent called cs1)

If I : [root@cs1 Desktop]# puppet agent -t Info: Retrieving pluginfacts Info: Retrieving plugin Info: Caching catalog for cs1.home Info: Applying configuration version '1436032639' Notice: Applied catalog in 0.02 seconds [root@cs1 Desktop]#

Then on master using: puppet master --no-daemonize --debug >/tmp/master.txt and tailing the log

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

I'm not entirely sure where the ".home" is coming from. I read on the internet it may be being put on by the home router (?) but my fqdn's are of the format cs1.localdomain but the /etc/hosts contain xxx.xxx.xxx.xxx cs1.localdomain cs1 cs1.home

-- Edit 2 --

FYI, when running puppet agent -t I get 5 files delivered from the server which do not reflect the compiled changes.

[root@cs1 Desktop]# find /opt/puppetlabs/ -type f -mmin -3 -exec ls -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 root 7628 Jul 6 14:56 /opt/puppetlabs/puppet/cache/state/last_run_report.yaml -rw-r----- 1 root root 29 Jul 6 14:56 /opt/puppetlabs/puppet/cache/state/resources.txt -rw-r--r-- 1 root root 407 Jul 6 14:56 /opt/puppetlabs/puppet/cache/state/last_run_summary.yaml -rw-rw---- 1 root root 3655 Jul 6 14:56 /opt/puppetlabs/puppet/cache/state/state.yaml -rw-r----- 1 root root 18 Jul 6 14:56 /opt/puppetlabs/puppet/cache/state/classes.txt


Solution

  • This scenario occurred because changes had been made to the network configuration on the puppet master. The network service had been restarted and changes verified manually (such as hostname and changes to /etc/hosts). The solution was simply to restart the puppet master.