From 5d06123df9aeb4c104843827afd855d9781aa914 Mon Sep 17 00:00:00 2001 From: Bill Weiss Date: Sun, 4 Nov 2012 17:44:23 -0600 Subject: Trivial fix for style, and made the README and comment match up Puppet-lint was complaining about "ensure found on line but it's not the first attribute on line 109". Trivial fix (swapped the ensure and the name). Also, the README didn't mention Debian or CentOS, but the comment block in init.pp did. I added both to the README. I happen to be using this with Debian unstable, but I haven't tested it extensively enough to say "yep, this works". It, however, works for me. --- manifests/init.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'manifests') diff --git a/manifests/init.pp b/manifests/init.pp index 21f4296..b404071 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -105,8 +105,8 @@ class ntp($servers='UNSET', if ($supported == true) { package { 'ntp': - name => $pkg_name, ensure => $package_ensure, + name => $pkg_name, } file { $config: -- cgit v1.2.3 From 89e8d1e3a6311a73409fe9fd4a9594bbf5a166ef Mon Sep 17 00:00:00 2001 From: stephen Date: Tue, 16 Oct 2012 12:48:29 +0100 Subject: have the module fail on unsupported os --- manifests/init.pp | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) (limited to 'manifests') diff --git a/manifests/init.pp b/manifests/init.pp index b404071..0d19747 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -51,7 +51,6 @@ class ntp($servers='UNSET', case $::operatingsystem { debian, ubuntu: { - $supported = true $pkg_name = [ 'ntp' ] $svc_name = 'ntp' $config = '/etc/ntp.conf' @@ -66,7 +65,6 @@ class ntp($servers='UNSET', } } centos, redhat, oel, linux, fedora, Amazon: { - $supported = true $pkg_name = [ 'ntp' ] $svc_name = 'ntpd' $config = '/etc/ntp.conf' @@ -80,7 +78,6 @@ class ntp($servers='UNSET', } } freebsd: { - $supported = true $pkg_name = ['.*/net/ntp'] $svc_name = 'ntpd' $config = '/etc/ntp.conf' @@ -95,15 +92,10 @@ class ntp($servers='UNSET', } } default: { - $supported = false - notify { "${module_name}_unsupported": - message => "The ${module_name} module is not supported on ${::operatingsystem}", - } + fail("The ${module_name} module is not supported on ${::operatingsystem}") } } - if ($supported == true) { - package { 'ntp': ensure => $package_ensure, name => $pkg_name, @@ -125,5 +117,4 @@ class ntp($servers='UNSET', hasrestart => true, subscribe => [ Package[$pkg_name], File[$config] ], } - } } -- cgit v1.2.3 From d218ce04872aeec45cfd0398824acf20e728aa18 Mon Sep 17 00:00:00 2001 From: stephen Date: Mon, 22 Oct 2012 10:41:45 +0100 Subject: Fix indentation --- manifests/init.pp | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'manifests') diff --git a/manifests/init.pp b/manifests/init.pp index 0d19747..74dcc5f 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -96,25 +96,25 @@ class ntp($servers='UNSET', } } - package { 'ntp': - ensure => $package_ensure, - name => $pkg_name, - } + package { 'ntp': + name => $pkg_name, + ensure => $package_ensure, + } - file { $config: - ensure => file, - owner => 0, - group => 0, - mode => '0644', - content => template("${module_name}/${config_tpl}"), - require => Package[$pkg_name], - } + file { $config: + ensure => file, + owner => 0, + group => 0, + mode => '0644', + content => template("${module_name}/${config_tpl}"), + require => Package[$pkg_name], + } - service { 'ntp': - ensure => $ensure, - name => $svc_name, - hasstatus => true, - hasrestart => true, - subscribe => [ Package[$pkg_name], File[$config] ], - } + service { 'ntp': + ensure => $ensure, + name => $svc_name, + hasstatus => true, + hasrestart => true, + subscribe => [ Package[$pkg_name], File[$config] ], + } } -- cgit v1.2.3 From 4b9a9e6f1288a4a98353d979aa92766ab27005d8 Mon Sep 17 00:00:00 2001 From: Tony Bussieres Date: Mon, 19 Nov 2012 13:46:43 -0500 Subject: added the enable parameter to the init class, so that one can configure ntp to start on boot. --- manifests/init.pp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'manifests') diff --git a/manifests/init.pp b/manifests/init.pp index 74dcc5f..e8a4c34 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -34,6 +34,7 @@ # [Remember: No empty lines between comments and class definition] class ntp($servers='UNSET', $ensure='running', + $enable='true', $autoupdate=false ) { @@ -110,11 +111,13 @@ class ntp($servers='UNSET', require => Package[$pkg_name], } - service { 'ntp': - ensure => $ensure, - name => $svc_name, - hasstatus => true, - hasrestart => true, - subscribe => [ Package[$pkg_name], File[$config] ], + service { 'ntp': + ensure => $ensure, + enable => $enable, + name => $svc_name, + hasstatus => true, + hasrestart => true, + subscribe => [ Package[$pkg_name], File[$config] ], + } } } -- cgit v1.2.3 From bd2a757b852a339fb22492598f39841825e6b12c Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Wed, 28 Nov 2012 11:40:01 -0500 Subject: Add restrict parameter NTP servers should not restrict themselves to 127.0.0.1, and this commit adds a `restrict` parameter to enable/disable this configuration block in the relevent templates. --- manifests/init.pp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'manifests') diff --git a/manifests/init.pp b/manifests/init.pp index e8a4c34..6f4cc8b 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -18,6 +18,12 @@ # '2.debian.pool.ntp.org iburst', # '3.debian.pool.ntp.org iburst', ] # +# $restrict = true +# Whether to restrict ntp daemons from allowing others to use as a server. +# +# $autoupdate = false +# Whether to update the ntp package automatically or not. +# # Actions: # # Installs, configures, and manages the ntp service. @@ -35,6 +41,7 @@ class ntp($servers='UNSET', $ensure='running', $enable='true', + $restrict=true, $autoupdate=false ) { -- cgit v1.2.3 From 78fdcf83c84fb35d689cfcf8ab560bad88ea74d0 Mon Sep 17 00:00:00 2001 From: Tony Bussieres Date: Mon, 10 Dec 2012 15:06:46 -0500 Subject: Fix service indentation, added parameter documentation --- manifests/init.pp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'manifests') diff --git a/manifests/init.pp b/manifests/init.pp index 6f4cc8b..29358bd 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -24,6 +24,9 @@ # $autoupdate = false # Whether to update the ntp package automatically or not. # +# $enable = true +# Automatically start ntp deamon on boot. +# # Actions: # # Installs, configures, and manages the ntp service. @@ -40,7 +43,7 @@ # [Remember: No empty lines between comments and class definition] class ntp($servers='UNSET', $ensure='running', - $enable='true', + $enable=true, $restrict=true, $autoupdate=false ) { @@ -118,13 +121,12 @@ class ntp($servers='UNSET', require => Package[$pkg_name], } - service { 'ntp': - ensure => $ensure, - enable => $enable, - name => $svc_name, - hasstatus => true, - hasrestart => true, - subscribe => [ Package[$pkg_name], File[$config] ], - } + service { 'ntp': + ensure => $ensure, + enable => $enable, + name => $svc_name, + hasstatus => true, + hasrestart => true, + subscribe => [ Package[$pkg_name], File[$config] ], } } -- cgit v1.2.3