Report abuse

# NTP daemon configuration classes 
# vim:ts=4:expandtab
# $Id: init.pp 129 2009-04-15 07:04:12Z paulway $

class ntpd {
    package { ntp : ensure => latest }

    file { "/etc/ntp.conf":
        owner   => root,
        group   => root,
        mode    => 644,
        require => Package["ntp"],
        source  => [ # In decreasing order of specificity
            "puppet:///ntpd/ntp-$hostname.conf",
            "puppet:///ntpd/ntp-$gateway.conf",
            "puppet:///ntpd/ntp-$zone.conf",
            "puppet:///ntpd/ntp.conf",
        ]
    }

    file { "/etc/ntp/step-tickers":
        owner   => root,
        group   => root,
        mode    => 644,
        source  => [ # In decreasing order of specificity
            "puppet:///ntpd/step-tickers-$hostname",
            "puppet:///ntpd/step-tickers-$gateway.conf",
            "puppet:///ntpd/step-tickers-$zone.conf",
            "puppet:///ntpd/step-tickers",
        ]
    }

    service { "ntpd":
        subscribe   => [Package[ntp], File["/etc/ntp.conf"]],
        ensure      => running,
    }

    nagios::nrpe_command { "check_time":
        command     => "check_ntp",
        parameters  => "-H localhost", # local to remote server
        nagios_plugin => "nagios-plugins-ntp",
    }
}

class ntpd::time_master inherits ntpd {

    File["/etc/ntp.conf"] { 
        source  => [ # In decreasing order of specificity
            "puppet:///ntpd/ntp-$hostname.conf",
            "puppet:///ntpd/ntp-$gateway.conf",
            "puppet:///ntpd/ntp-$zone.conf",
            "puppet:///ntpd/ntp-time-master.conf",
        ]
    }

    File["/etc/ntp/step-tickers"] {
        source  => [ # In decreasing order of specificity
            "puppet:///ntpd/step-tickers-$hostname",
            "puppet:///ntpd/step-tickers-$gateway.conf",
            "puppet:///ntpd/step-tickers-$zone.conf",
            "puppet:///ntpd/step-tickers-time-master",
        ]
    }

}