Skip to content

petersonwsantos/puppet-ntp

Repository files navigation

Build Status GitHub release GitHub issues

Puppet Module - NTP

Description

The ntp module installs, configures, and manages the NTP service across a range of operating systems and distributions.

Usage

All parameters for the ntp module are contained within the main ::ntp class, so for any function of the module, set the options you want. See the common usages below for examples.

Install and enable NTP

include '::ntp'

Change NTP servers

List of Stratum One Time Servers

List of Stratum One Time Servers

class { '::ntp':
  config_servers => [ 'ntp1.corp.com', 'ntp2.corp.com' ],
}

Restrict who can connect

class { '::ntp':
  config_servers  => [ 'ntp1.corp.com', 'ntp2.corp.com' ],
  config_restrict => ['127.0.0.1'],
}

Install a client that can't be queried

class { '::ntp':
  config_servers   => ['ntp1.corp.com', 'ntp2.corp.com'],
  config_restrict  => [
    'default ignore',
    '-6 default ignore',
    '127.0.0.1',
    '-6 ::1',
    'ntp1.corp.com nomodify notrap nopeer noquery',
    'ntp2.corp.com nomodify notrap nopeer noquery'
  ],
}

Reference

Classes

Public classes

  • ntp: Main class, includes all other classes.

Private classes

  • ntp::install: Handles the packages.
  • ntp::config: Handles the configuration file.
  • ntp::service: Handles the service.

Hiera example

---
ntp::package_ensure: present
ntp::package_manage: true
ntp::package_name: 
  - 'ntp'
ntp::service_name: ntpd
ntp::service_enable: true
ntp::service_ensure: running
ntp::service_manage: true
ntp::config_servers:
  - '0.pool.ntp.org'
  - '1.pool.ntp.org'
  - '2.pool.ntp.org'
  - '3.pool.ntp.org'
ntp::config_restrict:
  - 'default nomodify notrap nopeer noquery kod limited'
  - '-6 default kod nomodify notrap nopeer noquery'
  - '127.0.0.1'
  - '-6 ::1'