Giter Club home page Giter Club logo

ansible-systemd-timesyncd's Introduction

Build Status

Role Name

Ansible role to configure the systemd-timesyncd service setting S/NTP and timezone parameters.

Requirements

  • systemd >= 2.9
  • systemd-timesyncd.service unit
  • dbus

Role Variables

config:
  timezone: 'Africa/Libreville'
  ntp_servers:
    - 0.pool.ntp.org
    - 1.pool.ntp.org
    - 2.pool.ntp.org
    - 3.pool.ntp.org
  root_distance_max_sec: 5
  poll_interval_max_sec: 2048
  poll_interval_min_sec: 32

Also see defaults/main.yml for more information on these parameters.

Dependencies

  • Debian-based running systemd-timesyncd (NOTE: systemd on the Redhat family (RHEL/Fedora/CentOs) is not compiled with timesyncd for NTP synchronization and uses chrony instead)

Conflicts

This role will likely fail to succeed in configuring timesyncd if the following services are enabled/running on the system.

  • ntp/ntpd - reference implementation
  • chrony/chronyd

Example Playbook

- name: TC2 - Run ansible-systemd-timesyncd role
  hosts: localhost
  remote_user: root
  roles:
  - role: ansible-systemd-timesyncd
    config:
      timezone: 'Africa/Libreville'

Also see tests/ for how tests are run.

References

License

Apache License, v2.0

Author Information

Shalom Bhooshi

ansible-systemd-timesyncd's People

Contributors

joschneid avatar shalomb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

iberezovskiy

ansible-systemd-timesyncd's Issues

Misspellings in README.md

Very good work on this Ansible Role and Git Repo.

I found some misspellings in your readme.md.

In Dependencies section:
Debian-based running systemd-timesyncd (NOTE: systemd on the Redhat family (RHEL/Fedora/CentOs) is not compiled with timesyncd for NTP syncrhonization and uses chrony instelad)

Should be
Debian-based running systemd-timesyncd (NOTE: systemd on the Redhat family (RHEL/Fedora/CentOs) is not compiled with timesyncd for NTP synchronization and uses chrony instead)

Again, thanks for your hard work and contribution to Ansible, and Open Source.

Support for python3 required

It seems like we rely on python + pypa 2.x still.

DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support

"Assert systemd-timesyncd status" task fails

I have noticed that the task "timesyncd : Assert systemd-timesyncd status" from

- name: Assert systemd-timesyncd status
fails on one of my hosts with the following error:

failed: [machine] (item={'regex': 'Started Network Time Synchronization', 'fail_msg': 'systemd-timesyncd does not appear to have started NTP Synchronization'}) => changed=false 
  ansible_loop_var: item
  assertion: timesyncd_status.stdout | regex_search("Started Network Time Synchronization")
  evaluated_to: false
  item:
    fail_msg: systemd-timesyncd does not appear to have started NTP Synchronization
    regex: Started Network Time Synchronization
  msg: systemd-timesyncd does not appear to have started NTP Synchronization

The output of sudo systemctl status systemd-timesyncd on the machine is:

● systemd-timesyncd.service - Network Time Synchronization
     Loaded: loaded (/lib/systemd/system/systemd-timesyncd.service; enabled; vendor preset: enabled)
     Active: active (running) since Tue 2021-11-30 00:13:23 CET; 3 weeks 1 days ago
       Docs: man:systemd-timesyncd.service(8)
   Main PID: 420 (systemd-timesyn)
     Status: "Initial synchronization to time server INTERNAL_IP:123 (INTERNAL_IP)."
      Tasks: 2 (limit: 4557)
     Memory: 1.3M
     CGroup: /system.slice/systemd-timesyncd.service
             └─420 /lib/systemd/systemd-timesyncd

Warning: journal has been rotated since unit was started, output may be incomplete.

everything is operating fine and yet the task asserts a failure. Perhaps it is not the most robust technique to try and regex-scrape the output of a shell command to try and look for logs of a service? I personally think this test can be removed.

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.