Giter Club home page Giter Club logo

puppet-ntp's Introduction

ntp

Build Status Code Coverage Puppet Forge Puppet Forge - downloads Puppet Forge - endorsement Puppet Forge - scores

Table of Contents

  1. Overview
  2. Module Description - What the module does and why it is useful
  3. Setup - The basics of getting started with ntp
  4. Usage - Configuration options and additional functionality
  5. Reference - An under-the-hood peek at what the module is doing and how
  6. Limitations - OS compatibility, etc.
  7. Development - Guide for contributing to the module

Overview

This module installs, configures and manages the NTP service.

Module Description

This module handles installing, configuring and running NTP across a range of operating systems and distributions.

Setup

What ntp affects

  • ntp package.
  • ntp configuration file.
  • ntp service.

Setup Requirements

Beginning with ntp

Install ntp with the default parameters (No configuration files will be changed).

    class { 'ntp': }

Install ntp with the recommended parameters.

Standalone setup

    class { 'ntp':
      config_file_template => "ntp/${::operatingsystem}/etc/ntp.conf.erb",
    }

Client/Server setup (client)

    class { 'ntp':
      config_file_template => "ntp/${::operatingsystem}/etc/ntp.conf.erb",
      server_internal      => [
        "ntp1.${::domain}",
        "ntp2.${::domain}",
      ],
    }

Client/Server setup (server)

    class { 'ntp':
      config_file_template => "ntp/${::operatingsystem}/etc/ntp-server.conf.erb",
      server_internal      => [
        "ntp1.${::domain}",
        "ntp2.${::domain}",
      ],
    }

Usage

Update the ntp package.

    class { 'ntp':
      package_ensure => 'latest',
    }

Remove the ntp package.

    class { 'ntp':
      package_ensure => 'absent',
    }

Purge the ntp package (All configuration files will be removed).

    class { 'ntp':
      package_ensure => 'purged',
    }

Deploy the configuration files from source directory.

    class { 'ntp':
      config_dir_source => "puppet:///modules/ntp/${::operatingsystem}/etc",
    }

Deploy the configuration files from source directory (Unmanaged configuration files will be removed).

    class { 'ntp':
      config_dir_purge  => true,
      config_dir_source => "puppet:///modules/ntp/${::operatingsystem}/etc",
    }

Deploy the configuration file from source.

    class { 'ntp':
      config_file_source => "puppet:///modules/ntp/${::operatingsystem}/etc/ntp.conf",
    }

Deploy the configuration file from string.

    class { 'ntp':
      config_file_string => '# THIS FILE IS MANAGED BY PUPPET',
    }

Deploy the configuration file from template.

    class { 'ntp':
      config_file_template => "ntp/${::operatingsystem}/etc/ntp.conf.erb",
    }

Deploy the configuration file from custom template (Additional parameters can be defined).

    class { 'ntp':
      config_file_template     => "ntp/${::operatingsystem}/etc/ntp.conf.erb",
      config_file_options_hash => {
        'key' => 'value',
      },
    }

Deploy additional configuration files from source, string or template.

    class { 'ntp':
      config_file_hash => {
        'ntp.2nd.conf' => {
          config_file_path   => '/etc/ntp.2nd.conf',
          config_file_source => "puppet:///modules/ntp/${::operatingsystem}/etc/ntp.2nd.conf",
        },
        'ntp.3rd.conf' => {
          config_file_path   => '/etc/ntp.3rd.conf',
          config_file_string => '# THIS FILE IS MANAGED BY PUPPET',
        },
        'ntp.4th.conf' => {
          config_file_path     => '/etc/ntp.4th.conf',
          config_file_template => "ntp/${::operatingsystem}/etc/ntp.4th.conf.erb",
        },
      },
    }

Disable the ntp service.

    class { 'ntp':
      service_ensure => 'stopped',
    }

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.

Parameters

package_ensure

Determines if the package should be installed. Valid values are 'present', 'latest', 'absent' and 'purged'. Defaults to 'present'.

package_name

Determines the name of package to manage. Defaults to 'ntp'.

package_list

Determines if additional packages should be managed. Defaults to 'undef'.

config_dir_ensure

Determines if the configuration directory should be present. Valid values are 'absent' and 'directory'. Defaults to 'directory'.

config_dir_path

Determines if the configuration directory should be managed. Defaults to '/etc'

config_dir_purge

Determines if unmanaged configuration files should be removed. Valid values are 'true' and 'false'. Defaults to 'false'.

config_dir_recurse

Determines if the configuration directory should be recursively managed. Valid values are 'true' and 'false'. Defaults to 'true'.

config_dir_source

Determines the source of a configuration directory. Defaults to 'undef'.

config_file_ensure

Determines if the configuration file should be present. Valid values are 'absent' and 'present'. Defaults to 'present'.

config_file_path

Determines if the configuration file should be managed. Defaults to '/etc/ntp.conf'

config_file_owner

Determines which user should own the configuration file. Defaults to 'root'.

config_file_group

Determines which group should own the configuration file. Defaults to 'root'.

config_file_mode

Determines the desired permissions mode of the configuration file. Defaults to '0644'.

config_file_source

Determines the source of a configuration file. Defaults to 'undef'.

config_file_string

Determines the content of a configuration file. Defaults to 'undef'.

config_file_template

Determines the content of a configuration file. Defaults to 'undef'.

config_file_notify

Determines if the service should be restarted after configuration changes. Defaults to 'Service[ntp]'.

config_file_require

Determines which package a configuration file depends on. Defaults to 'Package[ntp]'.

config_file_hash

Determines which configuration files should be managed via ntp::define. Defaults to '{}'.

config_file_options_hash

Determines which parameters should be passed to an ERB template. Defaults to '{}'.

service_ensure

Determines if the service should be running or not. Valid values are 'running' and 'stopped'. Defaults to 'running'.

service_name

Determines the name of service to manage. Defaults to 'ntp'.

service_enable

Determines if the service should be enabled at boot. Valid values are 'true' and 'false'. Defaults to 'true'.

server_external

Determines which hosts should be used as synchronization source (external). Defaults to '["0.${::operatingsystem}.pool.ntp.org", "1.${::operatingsystem}.pool.ntp.org", "2.${::operatingsystem}.pool.ntp.org", "3.${::operatingsystem}.pool.ntp.org"]'.

server_internal

Determines which hosts should be used as synchronization source (internal). If more than one internal NTP server is used, they begin to synchronize with each other. Defaults to 'undef'.

Limitations

This module has been tested on:

  • Debian 6/7/8
  • Ubuntu 12.04/14.04/16.04

Development

Bug Report

If you find a bug, have trouble following the documentation or have a question about this module - please create an issue.

Pull Request

If you are able to patch the bug or add the feature yourself - please make a pull request.

Contributors

The list of contributors can be found at: https://github.com/dhoppe/puppet-ntp/graphs/contributors

puppet-ntp's People

Contributors

dhoppe avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.