Git Product home page Git Product logo

windowstime's Introduction

windowstime

Table of Contents

  1. Description
  2. Setup - The basics of getting started with windowstime
  3. Development - Guide for contributing to the module

Description

This module configures NTP sync on Windows Servers. It's extremely useful on standalone instances not connected to AD, but can also be modified to sync from the AD domain where required by changing the syncflag setting from 'local' to 'domain'. It switches the W32time Service from triggered to running, so it's constantly verifying and syncing the clock. It can also configure the systems in the correct timezone.

Setup

What windowstime affects

  • Alters the HKLM\SYSTEM\CurrentControlSet\Services\W32Time\Parameters\NtpServer to the defined list (and flags) of NTP servers.
  • Alters HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Parameters\Type to NTP or NT5DS depending on syncflag setting (default: NTP)
  • Configures the w32time service.
  • Does an initial resync.
  • If timezone is set, it will configure the system to the specified timezone.

Node Graph

Beginning with windowstime

You can just include the class to configure the server to sane defaults:

  include ::windowstime

Or configure your own NTP servers:

    class { 'windowstime':
      servers => { 'pool.ntp.org'     => '0x01',
                   'time.windows.com' => '0x01',
                 }
    }

Or configure your NTP servers and the syncflag:

   class { 'windowstime':
     servers => { 'pool.ntp.org' => '0x01',
                  'time.windows.com' => '0x02',
                },
     syncflag => 'local',
   }

Or configure your NTP servers and the timezone:

    class { 'windowstime':
      servers  => { 'pool.ntp.org'     => '0x01',
                    'time.windows.com' => '0x01',
                  },
      timezone => 'Greenwich Standard Time',
    }

Timezone values are validated to parameters accepted from the tzutil command. You can check the full list on data/common.yaml.

Please ensure that servers have the correct flag:

  • 0x01 SpecialInterval
  • 0x02 UseAsFallbackOnly
  • 0x04 SymmatricActive
  • 0x08 Client

Development

Regular rules apply, send a PR and I promise to look at it as soon as I can.

windowstime's People

Contributors

joelschoenberg avatar ncorrare avatar term1n4l avatar

Stargazers

 avatar

Watchers

 avatar  avatar

windowstime's Issues

Windows Server 2016, constantly runs

The module runs on Windows Server 2016 and sets the timezone settings. However it runs on every puppet run even when the settings are already in place. Can you please fix this so it does not run if the settings are present already?

0.4.4 not available?

the current Bolt training from Puppet makes use of this module in the discussion on plans, and I notice the module warns about using Hiera 4. It looks like commit 52ea437 never made it to a released version?

tzutil complains about wrong number of arguments

Hi there, I got this error:

Notice: /Stage[main]/Windowstime/Exec[C:\Windows\system32\tzutil.exe /s 'Central European Standard Time']/returns: TZUTIL: Ungültige Anzahl von Argumenten für "/s".
Notice: /Stage[main]/Windowstime/Exec[C:\Windows\system32\tzutil.exe /s 'Central European Standard Time']/returns: Zeigen Sie mithilfe von "TZUTIL /?" eine Liste mit gültigen Optionen an.

Which is German for wrong number of arguments. There is an easy fix:

diff --git a/manifests/init.pp b/manifests/init.pp
index 44012ed..89de205 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -88,7 +88,7 @@ class windowstime (
     validate_re($timezone, $timezones, 'The specified string is not a valid Timezone')
     if $timezone != $facts['timezone'] {
       $system32dir = $facts['os']['windows']['system32']
-      exec { "${system32dir}\\tzutil.exe /s ${timezone}":
+      exec { "${system32dir}\\tzutil.exe /s \"${timezone}\"":
       }
     }
   }

Sorry, I'm too busy for a pull request.

facter returns time in German

Because facter on our systems returns the TZ in German, puppet keeps trying to set the timezone.

C:\Users\Administrator>facter timezone
Mitteleuropäische Zeit

So I tried setting the TZ with tzutil in German and guess what... It only accepts timezone in English.

Any clever hacks to work around this issue?

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.