Last active
February 4, 2026 20:22
-
-
Save mschmitt/0895da5e328775858b21bf4e5cc8d56c to your computer and use it in GitHub Desktop.
Replace systemd-timesyncd with standard ntpd
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # sudo bash -c 'ansible-playbook <(curl -s https://gist.githubusercontent.com/mschmitt/0895da5e328775858b21bf4e5cc8d56c/raw/play-ntp.yml)' | |
| --- | |
| - hosts: localhost | |
| gather_facts: true | |
| connection: local | |
| tasks: | |
| - name: Disable systemd-timesyncd | |
| systemd_service: | |
| name: systemd-timesyncd | |
| state: stopped | |
| enabled: false | |
| - name: Install ntp (Arch) | |
| package: | |
| name: ntp | |
| state: present | |
| when: ansible_facts['os_family'] == 'Archlinux' | |
| - name: Install ntpsec and ntpdate (Debian) | |
| package: | |
| name: | |
| - ntpsec | |
| - ntpsec-ntpdate | |
| state: present | |
| when: ansible_facts['os_family'] == 'Debian' | |
| - name: Ensure ntpd is stopped | |
| systemd_service: | |
| name: ntpd | |
| state: stopped | |
| - name: Acquire time | |
| command: ntpdate pool.ntp.org | |
| - name: Start and enable ntpdate (Arch) | |
| systemd_service: | |
| name: ntpd | |
| state: started | |
| enabled: true | |
| when: ansible_facts['os_family'] == 'Archlinux' | |
| - name: Start and enable ntpd | |
| systemd_service: | |
| name: ntpd | |
| state: started | |
| enabled: true | |
| # vim: filetype=yaml |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment