- Description
- Setup - The basics of getting started with nscd
- Usage - Configuration options and additional functionality
- Reference - An under-the-hood peek at what the module is doing and how
- Limitations - OS compatibility, etc.
- Development - Guide for contributing to the module
The nscd module installs, configures and manages the name service cache daemon on unix-like operating systems.
- The
nscdpackage will be installed unlesspackage_manageis set tofalse - The
nscd.confconfiguration file will be overwritten unlessconfig_manageis set tofalse
Declare the main ::nscd class and apply default cache configurations:
class { '::nscd' : service_defaults => true }
Daemon configuration is managed through the main ::nscd class while individual
service caches (such as passwd or group) are managed using declarations of
the ::nscd::cache resource type.
class { '::nscd' : }
This will install the nscd package, configure daemon defaults and start the
nscd service. No caches will be configured or enabled.
class { '::nscd' : service_defaults => true }
This will install the nscd package, configure daemon defaults, enable and configure service caches as per the defaults for your operating system and finally start the nscd service.
class { '::nscd' : }
nscd::cache { 'passwd' :
positive_ttl => 600,
negative_ttl => 20,
persistent => true,
shared => true,
auto_propagate => true,
}
nscd::cache { 'group' :
positive_ttl => 3600,
negative_ttl => 60,
persistent => true,
shared => true,
auto_propagate => true,
}
This will install the nscd package, configure daemon defaults, enable and
configure service caches for passwd and group and finally start the nscd
service.
Guides the basic setup and installation of the name service cache daemon on your system.
When this class is declared with the default options, Puppet:
- Installs the
nscdsoftware package for your operating system - Replaces and manages the
nscd.confconfiguration file- Distribution defaults are used for the daemon itself
- Binary defaults are used for all supported caches unless
service_defaultsis set totruein which case distribution defaults are configured
- Enables and starts the
nscdservice
You can validate the state of nscd and its caches by calling
$ nscd --statistics
Parameters within nscd:
Set the path fo the nscd configuration file to be managed.
Default: /etc/nscd.conf
Determines whether to manage the nscd daemon configuration file. If false,
the configuration file must be managed manually and ::nscd::cache definitions
will fail. Valid options: Boolean. Default: true.
Sets the desired debug level for the log file. Default: 0.
Set the path of the daemon log file. Default: /var/log/nscd.log.
Sets the maximum number of threads. Default: 32.
Controls the package resource's [ensure][] attribute. Valid options:
'absent', 'installed' (or the equivalent 'present'), or a version string.
Default: 'installed'.
Determines whether the nscd package will be installed and managed. Set to
false if you wish to manually manage the installation. Valid options: Boolean.
Default: true.
Sets the names of the package to be installed. Default: nscd.
Determines whether to enable paranoia mode which causes nscd to restart itself periodically. Valid options: Boolean. Default: true.
Sets the limit on the number of times a cached entry gets reloaded without being used before it gets removed. Default: 5.
Sets the restart interval to time seconds if periodic restart is enabled by enabling paranoia mode. Default: 3600 (1 hour).
Determines whether default cache service configurations should be applied by
including the ::nscd::service_defaults class and its ::nscd::cache
declarations. Valid options: Boolean. Default: true.
Determines whether Puppet enables the nscd service when the system is booted. Valid options: Boolean. Default: true.
Determines whether Puppet should make sure the service is running. Valid options: 'true' (equivalent to 'running'), 'false' (equivalent to 'stopped'). Default: 'running'.
Determines whether Puppet manages the nscd service's state. Valid options: Boolean. Default: true.
Sets the name of the nscd service. Default: nscd.
Sets the name of the service account under which the nscd service will run.
Default: nscd.
Sets the group ID of the nscd service account. Default: 28.
Determines whether Puppet manages the nscd service account. Valid options: Boolean. Default: true.
Sets the user ID of the nscd service account. Default: 28.
Specifies the user who is allowed to request statistics.
Set the number of threads that are started to wait for requests. At least five threads will always be created. Default: 4.
Manages the nscd configuration file.
Installs the nscd package.
Manages nscd parameters for different operating systems.
Manages the nscd daemon and runtime user account.
Defines default ::nscd::cache configurations for the targeted operating
system.
Defines the configuration for a supported service cache.
Parameters within nscd::cache:
Sets the name of the service to be configured.
When set to false for passwd or group service, then the .byname requests
are not added to passwd.byuid or group.bygid cache. This can help with
tables containing multiple records for the same ID. This parameter is valid only
for services passwd and group. Default: undef.
Enables or disables checking the file belonging to the specified service for changes. Valid options: Boolean. Default: true.
Enables or disables the specified service cache. Valid options: Boolean. Default: true.
The maximum allowable size, in bytes, of the database files for the service. Default: 33554432 (32MB).
Sets the TTL (time-to-live) for negative entries (unsuccessful queries) in the
specified cache for service. Value is in seconds. Can result in significant
performance improvements if there are several files owned by UIDs (user IDs) not
in system databases (for example untarring the Linux kernel sources as root);
should be kept small to reduce cache coherency problems. Required.
Default: undef.
Keep the content of the cache for service over server restarts; useful when paranoia mode is set. Valid options: Boolean. Default: false.
Sets the TTL (time-to-live) for positive entries (successful queries) in the
specified cache for service. Value is in seconds. Larger values increase cache
hit rates and reduce mean response times, but increase problems with cache
coherence. Required. Default: undef.
The memory mapping of the nscd databases for service is shared with the clients so that they can directly search in them instead of having to ask the daemon over the socket each time a lookup is performed. Valid options: Boolean. Default: false.
Sets the the internal hash table size. Value should remain a prime number for optimum efficiency. Default: 211.
As per Ubuntu bug 1068889,
the netgroup service cache is known not to work on Debian based systems and is
therefore disable by default by this module.
Contributions are welcome in the form of issues and pull requests on GitHub.