summaryrefslogtreecommitdiff
path: root/manifests
diff options
context:
space:
mode:
authorAshley Penney <ashley.penney@puppetlabs.com>2013-07-29 16:02:50 -0400
committerAshley Penney <ashley.penney@puppetlabs.com>2013-07-29 17:09:26 -0400
commit0235486d2d6de477bfa93487b03e6ca37cb2d24c (patch)
tree7a8e7e1efcf0ce72382182661b9e7c581d7b67fa /manifests
parentc5408ae4b17bc3b395b13d10c9473e15661d2d38 (diff)
Add new parameters to allow more flexible configuration.
`driftfile` [String]: Allows the setting of the driftfile location. `keys_enable` [Boolean]: Should the ntp keys option be enabled? `keys_file` [String]: Where are the keys stored? `keys_trusted` [Array]: List of keys to trust. `keys_requestkey` [String]: Request key to use. `keys_controlkey` [String]: Control key to use. If keys_enable is set then the directory that keysfile is stored in is created (recursively). Currently we don't manage the keys file but that is an option to be added.
Diffstat (limited to 'manifests')
-rw-r--r--manifests/config.pp17
-rw-r--r--manifests/init.pp23
-rw-r--r--manifests/params.pp41
3 files changed, 66 insertions, 15 deletions
diff --git a/manifests/config.pp b/manifests/config.pp
index 0a4a710..45279be 100644
--- a/manifests/config.pp
+++ b/manifests/config.pp
@@ -1,11 +1,28 @@
class ntp::config (
$config = $ntp::config,
$config_template = $ntp::config_template,
+ $driftfile = $ntp::driftfile,
+ $keys_enable = $ntp::keys_enable,
+ $keys_file = $ntp::keys_file,
+ $keys_controlkey = $ntp::keys_controlkey,
+ $keys_requestkey = $ntp::keys_requestkey,
+ $keys_trusted = $ntp::keys_trusted,
$panic = $ntp::panic,
$restrict = $ntp::restrict,
$servers = $ntp::servers,
) inherits ntp {
+ if $keys_enable {
+ $directory = dirname($keys_file)
+ file { $directory:
+ ensure => directory,
+ owner => 0,
+ group => 0,
+ mode => '0755',
+ recurse => true,
+ }
+ }
+
file { $config:
ensure => file,
owner => 0,
diff --git a/manifests/init.pp b/manifests/init.pp
index 61a5ad9..d406fb3 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -2,6 +2,12 @@ class ntp (
$autoupdate = $ntp::params::autoupdate,
$config = $ntp::params::config,
$config_template = $ntp::params::config_template,
+ $driftfile = $ntp::params::driftfile,
+ $keys_enable = $ntp::params::keys_enable,
+ $keys_file = $ntp::params::keys_file,
+ $keys_controlkey = $ntp::params::keys_controlkey,
+ $keys_requestkey = $ntp::params::keys_requestkey,
+ $keys_trusted = $ntp::params::keys_trusted,
$package_ensure = $ntp::params::package_ensure,
$package_name = $ntp::params::package_name,
$panic = $ntp::params::panic,
@@ -13,6 +19,23 @@ class ntp (
$service_name = $ntp::params::service_name,
) inherits ntp::params {
+ validate_absolute_path($config)
+ validate_string($config_template)
+ validate_absolute_path($driftfile)
+ validate_bool($keys_enable)
+ validate_re($keys_controlkey, ['^\d+$', ''])
+ validate_re($keys_requestkey, ['^\d+$', ''])
+ validate_array($keys_trusted)
+ validate_string($package_ensure)
+ validate_array($package_name)
+ validate_bool($panic)
+ validate_bool($restrict)
+ validate_array($servers)
+ validate_bool($service_enable)
+ validate_string($service_ensure)
+ validate_bool($service_manage)
+ validate_string($service_name)
+
if $autoupdate {
notice('autoupdate parameter has been deprecated and replaced with package_ensure. Set this to latest for the same behavior as autoupdate => true.')
}
diff --git a/manifests/params.pp b/manifests/params.pp
index 45551a8..9e91cce 100644
--- a/manifests/params.pp
+++ b/manifests/params.pp
@@ -1,22 +1,28 @@
class ntp::params {
- $autoupdate = false
- $package_ensure = 'present'
- $restrict = true
- $service_enable = true
- $service_ensure = 'running'
- $service_manage = true
+ $autoupdate = false
+ $config_template = 'ntp/ntp.conf.erb'
+ $keys_enable = false
+ $keys_controlkey = ''
+ $keys_requestkey = ''
+ $keys_trusted = []
+ $package_ensure = 'present'
+ $restrict = true
+ $service_enable = true
+ $service_ensure = 'running'
+ $service_manage = true
# On virtual machines allow large clock skews.
- $panic = $::is_virtual ? {
- 'true' => false,
+ $panic = str2bool($::is_virtual) ? {
+ true => false,
default => true,
}
case $::osfamily {
'Debian': {
$config = '/etc/ntp.conf'
- $config_template = 'ntp/ntp.conf.debian.erb'
+ $keysfile = '/etc/ntp/keys'
+ $driftfile = '/var/lib/ntp/drift'
$package_name = [ 'ntp' ]
$service_name = 'ntp'
$servers = [
@@ -28,7 +34,8 @@ class ntp::params {
}
'RedHat': {
$config = '/etc/ntp.conf'
- $config_template = 'ntp/ntp.conf.el.erb'
+ $driftfile = '/var/lib/ntp/drift'
+ $keysfile = '/etc/ntp/keys'
$package_name = [ 'ntp' ]
$service_name = 'ntpd'
$servers = [
@@ -39,7 +46,8 @@ class ntp::params {
}
'SuSE': {
$config = '/etc/ntp.conf'
- $config_template = 'ntp/ntp.conf.suse.erb'
+ $driftfile = '/var/lib/ntp/drift/ntp.drift'
+ $keysfile = '/etc/ntp/keys'
$package_name = [ 'ntp' ]
$service_name = 'ntp'
$servers = [
@@ -51,7 +59,8 @@ class ntp::params {
}
'FreeBSD': {
$config = '/etc/ntp.conf'
- $config_template = 'ntp/ntp.conf.freebsd.erb'
+ $driftfile = '/var/db/ntpd.drift'
+ $keysfile = '/etc/ntp/keys'
$package_name = ['net/ntp']
$service_name = 'ntpd'
$servers = [
@@ -63,8 +72,9 @@ class ntp::params {
}
'Archlinux': {
$config = '/etc/ntp.conf'
- $config_template = 'ntp/ntp.conf.archlinux.erb'
- $package_name = ['ntp']
+ $driftfile = '/var/lib/ntp/drift'
+ $keysfile = '/etc/ntp/keys'
+ $package_name = [ 'ntp' ]
$service_name = 'ntpd'
$servers = [
'0.pool.ntp.org',
@@ -77,7 +87,8 @@ class ntp::params {
case $::operatingsystem {
'Gentoo': {
$config = '/etc/ntp.conf'
- $config_template = 'ntp/ntp.conf.gentoo.erb'
+ $driftfile = '/var/lib/ntp/drift'
+ $keysfile = '/etc/ntp/keys'
$package_name = ['net-misc/ntp']
$service_name = 'ntpd'
$servers = [