Puppet client is not applying changes.

asked 2018-01-22 13:23:30 -0600

don11801 gravatar image

I'm running puppet 5.1 in RedHat linux 6.7. I'm unable to push the changes to any of the clients. Agent is applying the catalog but doesn't apply the changes.

Puppet Version:
        puppet5-release-5.0.0-1.el6.noarch
        puppetserver-5.1.4-1.el6.noarch
        puppet-agent-5.3.3-1.el6.x86_64

p-client3:/root # puppet agent -t
Info: Using configured environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Caching catalog for p-client3.fqdn
Info: Applying configuration version '1516038964'
Notice: Applied catalog in 0.02 seconds

p-client3:/root # puppet master --configprint all | egrep 'manifest|modules'
basemodulepath = /etc/puppetlabs/code/modules:/opt/puppetlabs/puppet/modules
default_manifest = ./manifests
disable_per_environment_manifest = false
genmanifest = false
manifest = /etc/puppetlabs/code/environments/production/manifests
modulepath = /etc/puppetlabs/code/environments/production/modules:/etc/puppetlabs/code/modules:/opt/puppetlabs/puppet/modules
ordering = manifest

Master Puppet.conf
---------------------------
[master]
vardir = /opt/puppetlabs/server/data/puppetserver
logdir = /var/log/puppetlabs/puppetserver
rundir = /var/run/puppetlabs/puppetserver
pidfile = /var/run/puppetlabs/puppetserver/puppetserver.pid
codedir = /etc/puppetlabs/code
environment_timeout = unlimited
dns_alt_names = puppetmaster.fqdn

[main]
certname = puppetmaster.fqdn
server = puppetmaster.fqdn
environment = production
runinterval = 1d
strict_variables = true

Client Puppet.conf
------------------
[main]
server = puppetmaster.fqd

[agent]
logdir = /var/log/puppetlabs/puppet
certname = p-client3.fqdn
server = puppetmaster.fqd
environment = production
runinterval = 1d

init.pp
--------
/etc/puppetlabs/code/environments/production/modules # cat init.pp
class absent_file {
  file { '/tmp/hello-file':
    ensure  => 'present',
    replace => 'no', # this is the important property
    content => "From Puppet\n",
    mode    => '0644',
  }
}

site.pp
--------
:/etc/puppetlabs/code/environments/production/manifests # cat site.pp
node default {
        include absent_file
}
edit retag flag offensive close merge delete

Comments

is your 'init.pp' directly in your /etc/puppetlabs/code/environments/production/modules directory? It needs to be within an absent_file directory. You, in theory, would be seeing an error from the 'include' statement not being able to find the module. Double check permissions on the site.pp file

DarylW gravatar imageDarylW ( 2018-01-22 14:29:14 -0600 )edit
DarylW gravatar imageDarylW ( 2018-01-22 14:30:41 -0600 )edit

made changes, still same puppetmaster:/../modules/absent_file # ls -ltr -rw-r--r-- 1 root root 189 Jan 20 10:44 init.pp puppetmaster:/../modules/absent_file # puppet parser validate init.pp # returns no error puppetmaster:/../manifests # ls -ld site.pp -rw-r--r-- 1 root root 39 Jan 20 10:42 site.pp

don11801 gravatar imagedon11801 ( 2018-01-22 15:08:20 -0600 )edit

I guess you have not. Follow the link given above or here: https://puppet.com/docs/puppet/5.3/modules_fundamentals.html You have to create a module first (not just a directory) and keep your code in manifest inside that module.

rajeevsharma gravatar imagerajeevsharma ( 2018-01-24 04:23:30 -0600 )edit

I went through the link & also followed step 4 (https://puppet.com/docs/pe/2016.4/quick_writing_nix.html) here. Am I still missing something? /root # puppet module list /etc/puppetlabs/code/environments/production/modules ├── absent_file (???) # didn't add it ├── puppetlabs-apache (v2.3.0)

don11801 gravatar imagedon11801 ( 2018-01-26 08:25:02 -0600 )edit