softbauware.ntp

Ansible Role: NTP

CI

This installs NTP (Network Time Protocol) on Linux systems.

Requirements

No specific requirements.

Role Variables

Here are the available variables and their default values (found in defaults/main.yml):

ntp_enabled: true

This determines if the NTP service will start and be enabled at system boot. On virtual machines running in containers (like OpenVZ or VirtualBox), it's suggested not to run the NTP daemon, because the host machine should synchronize time for the virtual machines.

ntp_timezone: Etc/UTC

This sets the timezone for your server.

ntp_package: ntp

This is the package to install for NTP functionality. The default is ntp for most systems, or chrony for RHEL/CentOS 7 and newer.

ntp_daemon: [various]

The default NTP daemon should be suitable for your system, but you can change it if needed (e.g., if you are using ntp on newer RHEL/CentOS versions).

ntp_config_file: /etc/ntp.conf

This indicates where the NTP configuration file is located. The default is /etc/ntp.conf for most systems or /etc/chrony.conf for RHEL/CentOS 7 and newer.

ntp_manage_config: false

Set this to true to allow this role to manage the NTP configuration file (/etc/ntp.conf).

ntp_driftfile: [various]

The default driftfile is generally correct for your system, but you may want to change it in some cases.

ntp_area: ""

This sets the NTP Pool Area to use. The default is empty, which means it will use the global pool.

ntp_servers:
  - "0{{ '.' + ntp_area if ntp_area else '' }}.pool.ntp.org iburst"
  - "1{{ '.' + ntp_area if ntp_area else '' }}.pool.ntp.org iburst"
  - "2{{ '.' + ntp_area if ntp_area else '' }}.pool.ntp.org iburst"
  - "3{{ '.' + ntp_area if ntp_area else '' }}.pool.ntp.org iburst"

These are the server settings for your NTP configuration file. Using the keyword "pool" is recommended if DNS resolution is possible; otherwise, use "server".

ntp_server_keyword: "pool"

Here you can specify which NTP servers you want to use. This only works if you allow the role to manage NTP’s configuration by setting ntp_manage_config to True.

ntp_restrict:
  - "127.0.0.1"
  - "::1"

Limits NTP access to these hosts; by default, it only allows the loopback addresses.

ntp_cron_handler_enabled: false

Indicates whether to restart the cron service after the timezone changes.

ntp_tinker_panic: true

This enables tinker panic, which is useful for running NTP in a virtual machine.

Dependencies

There are no dependencies.

Example Playbook

- hosts: all
  roles:
    - softbauware.ntp

In vars/main.yml:

ntp_timezone: America/Chicago

License

This role is licensed under MIT / BSD.

Author Information

This role was created in 2014 by Jeff Geerling, the author of Ansible for DevOps.

Informazioni sul progetto

NTP installation and configuration for Linux.

Installa
ansible-galaxy install softbauware.ntp
Licenza
mit
Download
130
Proprietario