Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .fixtures.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
fixtures:
repositories:
"common":
repo: "git://github.com/ghoneycutt/puppet-module-common.git"
ref: "v1.0.2"
"stdlib":
repo: "git://github.com/puppetlabs/puppetlabs-stdlib.git"
ref: "3.2.0"
Expand Down
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
---
env:
- PUPPET_VERSION=2.7.23
- PUPPET_VERSION=3.2.4
- PUPPET_VERSION=2.7.22
- PUPPET_VERSION=3.3.2
notifications:
email: false
rvm:
- 1.9.3
- 1.8.7
matrix:
allow_failures:
- env: PUPPET_VERSION=2.7.23
- env: PUPPET_VERSION=2.7.22
language: ruby
before_script: "gem install --no-ri --no-rdoc bundler"
script: 'bundle exec rake validate && bundle exec rake lint && SPEC_OPTS="--format documentation" bundle exec rake spec'
Expand Down
1 change: 1 addition & 0 deletions Modulefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ description 'Manages NTP server'
project_page 'https://github.com/ghoneycutt/puppet-module-ntp'

dependency 'puppetlabs/stdlib', '3.2.x'
dependency 'ghoneycutt/common', '>= 1.0.2'
35 changes: 27 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,30 @@
# ntp module #
# ntp module
===

[![Build Status](https://api.travis-ci.org/ghoneycutt/puppet-module-ntp.png?branch=master)](https://travis-ci.org/ghoneycutt/puppet-module-ntp)

Puppet module to manage ntp

# Compatibility #
===

# Compatibility

This module is supported on the following systems with Puppet v3.

This module is supported by the following OS families.
* Debian 6
* EL 5
* EL 6
* Solaris 9
* Solaris 10
* Solaris 11
* Suse 9
* Suse 10
* Suse 11
* Ubuntu 12.04 LTS

* Debian
* Redhat
* Suse 9, 10, 11
* Solaris 9, 10, 11
===

# Parameters #
# Parameters

See ntp.conf(5) for more information regarding settings.

Expand Down Expand Up @@ -50,6 +63,12 @@ ntp.conf's mode

- *Default*: 0644

step_tickers_ensure
-------------------
Ensure step tickers file. Valid values are 'present' and 'absent'.

- *Default*: based on OS

service_running
---------------
If service should be running
Expand Down
12 changes: 9 additions & 3 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@ PuppetLint.configuration.ignore_paths = ["spec/**/*.pp", "pkg/**/*.pp"]

desc "Run puppet in noop mode and check for syntax errors."
task :validate do
Dir['manifests/**/*.pp'].each do |path|
sh "puppet parser validate --noop #{path}"
end
Dir['manifests/**/*.pp'].each do |path|
sh "puppet parser validate --noop #{path}"
end
Dir['spec/**/*.rb','lib/**/*.rb'].each do |spec_path|
sh "ruby -c #{spec_path}" unless spec_path =~ /spec\/fixtures/
end
Dir['templates/**/*.erb'].each do |template|
sh "erb -P -x -T '-' #{template} | ruby -c"
end
end
82 changes: 30 additions & 52 deletions manifests/init.pp
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
# Class: ntp
# == Class: ntp
#
# This module manages the ntp service.
#
# Actions:
#
# Installs, configures, and manages the ntp service.
#
# Requires:
#
# Sample Usage:
# include ntp
# This module manages the ntp service.
#
class ntp (
$config_file_owner = 'root',
Expand Down Expand Up @@ -97,40 +88,34 @@
}

case $::osfamily {
'debian': {
'Debian': {
$default_package_name = [ 'ntp' ]
$default_package_noop = false
$default_package_source = undef
$default_package_adminfile = undef
$default_step_tickers_ensure = 'absent'
$default_service_name = 'ntp'
$default_config_file = '/etc/ntp.conf'
$default_driftfile = '/var/lib/ntp/ntp.drift'

# Verified that Ubuntu does not use /etc/ntp/step-tickers by default.
if $::operatingsystem == 'Ubuntu' {
$step_tickers_enable = false
} else {
$step_tickers_enable = true
}
}
'redhat': {
'RedHat': {
$default_package_name = [ 'ntp' ]
$default_package_noop = false
$default_package_source = undef
$default_package_adminfile = undef
$default_step_tickers_ensure = 'present'
$default_service_name = 'ntpd'
$default_config_file = '/etc/ntp.conf'
$default_driftfile = '/var/lib/ntp/ntp.drift'
$step_tickers_enable = true
}
'suse': {
'Suse': {
$default_package_noop = false
$default_package_source = undef
$default_package_adminfile = undef
$default_step_tickers_ensure = 'absent'
$default_service_name = 'ntp'
$default_config_file = '/etc/ntp.conf'
$default_driftfile = '/var/lib/ntp/ntp.drift'
$step_tickers_enable = true

case $::lsbmajdistrelease {
'9','10': {
Expand All @@ -144,7 +129,7 @@
}
}
}
'solaris': {
'Solaris': {
case $::kernelrelease {
'5.9','5.10': {
$default_package_name = [ 'SUNWntp4r', 'SUNWntp4u' ]
Expand All @@ -159,13 +144,13 @@
$default_package_noop = true
$default_package_source = '/var/spool/pkg'
$default_package_adminfile = '/var/sadm/install/admin/puppet-ntp'
$default_step_tickers_ensure = 'absent'
$default_service_name = 'ntp4'
$default_config_file = '/etc/inet/ntp.conf'
$default_driftfile = '/var/ntp/ntp.drift'
$step_tickers_enable = false
}
default: {
fail("The ntp module is supported by OS Families Debian, Redhat, Suse, and Solaris. Your operatingsystem, ${::operatingsystem}, is part of the osfamily, ${::osfamily}")
fail("The ntp module is supported by OS Families Debian, RedHat, Suse, and Solaris. Your operatingsystem, ${::operatingsystem}, is part of the osfamily, ${::osfamily}")
}
}

Expand Down Expand Up @@ -211,29 +196,15 @@
$driftfile_real = $driftfile
}

case $step_tickers_enable {
true: {
$default_step_tickers_ensure = present
$step_tickers_owner_real = $step_tickers_owner
$step_tickers_group_real = $step_tickers_group
$step_tickers_mode_real = $step_tickers_mode
}
false: {
$default_step_tickers_ensure = absent
$step_tickers_owner_real = undef
$step_tickers_group_real = undef
$step_tickers_mode_real = undef
}
default: {
fail("step_tickers_enable must be true or false. Current value is ${step_tickers_enable}")
}
}

if $step_tickers_ensure == 'USE_DEFAULTS' {
$step_tickers_ensure_real = $default_step_tickers_ensure
} else {
$step_tickers_ensure_real = $step_tickers_ensure
}
validate_re($step_tickers_ensure_real, '^(present)|(absent)$',
"ntp::step_tickers_ensure must be 'present' or 'absent'. Detected value is <${step_tickers_ensure_real}>.")

validate_absolute_path($step_tickers_path)

# validate $my_enable_stats - must be true or false
case $my_enable_stats {
Expand Down Expand Up @@ -275,14 +246,21 @@
require => Package['ntp_package'],
}

file { 'step-tickers':
ensure => $step_tickers_ensure_real,
path => $step_tickers_path,
owner => $step_tickers_owner_real,
group => $step_tickers_group_real,
mode => $step_tickers_mode_real,
content => template('ntp/step-tickers.erb'),
require => Package['ntp_package'],
if $step_tickers_ensure_real == 'present' {

common::mkdir_p { $step_tickers_path: }

file { 'step-tickers':
ensure => $step_tickers_ensure_real,
path => $step_tickers_path,
owner => $step_tickers_owner,
group => $step_tickers_group,
mode => $step_tickers_mode,
content => template('ntp/step-tickers.erb'),
require => [ Package['ntp_package'],
Common::Mkdir_p[$step_tickers_path],
],
}
}

service { 'ntp_service':
Expand Down
Loading