Puppet configuration Based on environmnet

45 views
Skip to first unread message

siv.d...@gmail.com

unread,
Aug 14, 2015, 5:14:26 AM8/14/15
to Puppet Users
Hi ALL:


This is my first time installation of puppet, 

I actuall install and confgiured puppet,

I configured the master and the agent in a particular environments.


But agent is not getting any configurations even though node is specified.

Puppet-server configuration.

[main]
    # The Puppet log directory.
    # The default value is '$vardir/log'.
    logdir = /var/log/puppet

    # Where Puppet PID files are kept.
    # The default value is '$vardir/run'.
    rundir = /var/run/puppet

    # Where SSL certificates are kept.
    # The default value is '$confdir/ssl'.
    ssldir = $vardir/ssl
    dns_alt_names =  puppetmaster.lab.com ,puppetmaster
    environmentpath = /etc/puppet/environments
    environment = Test
[agent]
    # The file in which puppetd stores a list of the classes
    # associated with the retrieved configuratiion.  Can be loaded in
    # the separate ``puppet`` executable using the ``--loadclasses``
    # option.
    # The default value is '$confdir/classes.txt'.
    classfile = $vardir/classes.txt

    # Where puppetd caches the local configuration.  An
    # extension indicating the cache format is added automatically.
    # The default value is '$confdir/localconfig'.
    localconfig = $vardir/localconfig


puppet agent configuration:


[main]
    # The Puppet log directory.
    # The default value is '$vardir/log'.
    logdir = /var/log/puppet

    # Where Puppet PID files are kept.
    # The default value is '$vardir/run'.
    rundir = /var/run/puppet

    # Where SSL certificates are kept.
    # The default value is '$confdir/ssl'.
    ssldir = $vardir/ssl
    certname = puppetagent.lab..com
    server =  puppetmaster.lab.com
    environment = Test
[agent]
    # The file in which puppetd stores a list of the classes
    # associated with the retrieved configuratiion.  Can be loaded in
    # the separate ``puppet`` executable using the ``--loadclasses``
    # option.
    # The default value is '$confdir/classes.txt'.
    classfile = $vardir/classes.txt
    #hiera_config = /etc/hiera.yaml
    # Where puppetd caches the local configuration.  An
    # extension indicating the cache format is added automatically.
    # The default value is '$confdir/localconfig'.
    localconfig = $vardir/localconfig


I have /etc/puppet/environments: and it has the module hmotd, 

/etc/puppet/environments/Test/modules/hmotd/manifests /{init.pp,site.pp}

init.pp
====

class hmotd (
$OSFlavor        = 'hardcoded flavor',
$Template        = 'templates/motd.conf.erb',
$FilePath        = '/tmp/motd',
$Environment     =  'hardcoded env',
$Packages        = 'hard packs',
$Role            = 'hard Role',
$whoamI          = 'hardcoded',
){

    file { "/tmp/motd":
        ensure  => "present",
        mode    => '0644',
        content => "test",
    }

}



site.pp:
=====


  include hmotd
}


When i do the puppet agent --debug --trace --test   --environment=Test -l /tmp/late.log on puppet agent,  Neither catalog is processed ,  nor error is thrown.


I see below in the log file:

Info: Retrieving plugin
Debug: /File[/var/lib/puppet/lib]/seluser: Found seluser default 'system_u' for                                                                   /var/lib/puppet/lib
Debug: /File[/var/lib/puppet/lib]/selrole: Found selrole default 'object_r' for                                                                   /var/lib/puppet/lib
Debug: /File[/var/lib/puppet/lib]/seltype: Found seltype default 'puppet_var_lib                                                                  _t' for /var/lib/puppet/lib
Debug: /File[/var/lib/puppet/lib]/selrange: Found selrange default 's0' for /var                                                                  /lib/puppet/lib
Debug: Failed to load library 'msgpack' for feature 'msgpack'
Debug: Puppet::Network::Format[msgpack]: feature msgpack is missing
Debug: file_metadata supports formats: pson b64_zlib_yaml yaml raw
Debug: Using cached connection for https://puppetmaster.lab.com:8140
Debug: Caching connection for https://puppetmaster.lab.com:8140
Debug: Finishing transaction 69875840162940
Debug: Evicting cache entry for environment 'Test'
Debug: Caching environment 'Test' (ttl = 0 sec)
Debug: Loading external facts from /var/lib/puppet/facts.d
Debug: Failed to load library 'msgpack' for feature 'msgpack'
Debug: Puppet::Network::Format[msgpack]: feature msgpack is missing
Debug: catalog supports formats: pson b64_zlib_yaml yaml dot raw
Debug: Using cached connection for https://puppetmaster.lab.com:8140
Debug: Caching connection for https://puppetmaster.lab.com:8140
Info: Caching catalog for puppetagent6.lab.qualys.com
Debug: Creating default schedules
Debug: Loaded state in 0.00 seconds
Info: Applying configuration version '1439494819'
Debug: Finishing transaction 69875840512860
Debug: Storing state
Debug: Stored state in 0.01 seconds
Notice: Finished catalog run in 0.02 seconds
Debug: Using cached connection for https://puppetmaster.lab.com:8140
Debug: Caching connection for https://puppetmaster.lab.com:8140
Debug: Closing connection for https://puppetmaster.lab.com:8140

Any pointers on why its is not picking up will be highly appreciated.

Thanks,
Dev


Josh Cooper

unread,
Aug 14, 2015, 10:53:00 AM8/14/15
to puppet...@googlegroups.com
The agent's name (as seen below) is "puppetagent6.lab.qualys.com", and since it doesn't match the above node name, the motd class is not included, and the master compiles an empty catalog.

--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/77ebd82f-1b6a-4648-8e56-90b2e3d414a8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Josh Cooper
Developer, Puppet Labs

PuppetConf 2015 is coming to Portland, Oregon! Join us October 5-9.
Register now to take advantage of the Early Bird discount save $249!
Reply all
Reply to author
Forward
0 new messages