Giter VIP home page Giter VIP logo

ansible-role-ntp's Introduction

Ansible Role: NTP

An Ansible role that installs NTP and configures it.

Table of Contents

Requirements

  • Ansible 2+

Role Variables

Time Zone

Set the system time zone. There is no default. The prefix is system_ on purpose, so this variable can be used across different roles that also set the time zone.

system_timezone: Europe/Berlin

NTP Servers

NTP servers are preferred servers. They should be set to your networks internal NTP servers.

ntp_servers:
  - ntp1.domain.org
  - ntp2.domain.org
  - ntp3.domain.org

NTP fallback servers should only be set for the above-mentioned NTP servers. Use regional pools.

ntp_fallback_servers:
  - 0.europe.pool.ntp.org
  - 1.europe.pool.ntp.org
  - 2.europe.pool.ntp.org
  - 3.europe.pool.ntp.org

If neither NTP servers nor fallback servers are specified, the default servers in the distributed configuration are used.

NTP peers are defined like this:

ntp_peers:
  - ntp2.domain.org
  - ntp3.domain.org

Peers will get an automatic restriction, i.e. nomodify notrap.

Restrict

Optionally ease restriction on the local network, i.e. nomodify notrap nopeer.

ntp_local_network_restriction:
  net: 192.168.1.0
  mask: 255.255.255.0

Dependencies

None.

Example Playbook

Add to requirements.yml:

---

- src: idiv-biodiversity.ntp

...

Download:

$ ansible-galaxy install -r requirements.yml

Top-Level Playbook

Write a top-level playbook:

---

- name: head server
  hosts: head

  roles:
    - role: idiv-biodiversity.ntp
      tags:
        - ntp
        - timesync

...

Role Dependency

Define the role dependency in meta/main.yml:

---

dependencies:

  - role: idiv-biodiversity.ntp
    tags:
      - ntp
      - timesync

...

Tags

With these tags, only specific parts of the role can be triggered:

  • timezone: just set the time zone
  • ntp-conf: configure /etc/ntp.conf and restart the service if changed
  • service, service-ntp and ntp-service: enable and start ntpd; the purpose of the plain service tag is that you can enable and start all services across roles by using this tag, e.g. ansible-playbook site.yml -t service

The tags from the Example Playbook are ntp and timesync. In case you switch from different time synchronization roles, the timesync tag should come in handy, in case these roles also use this tag.

License

MIT

Author Information

This role was created in 2017 by Christian Krause aka wookietreiber at GitHub, HPC cluster systems administrator at the German Centre for Integrative Biodiversity Research (iDiv).

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.