44 lines
905 B
YAML
44 lines
905 B
YAML
---
|
|
- name: Deinstall NTProtocol package(s)
|
|
package:
|
|
name: "{{ item }}"
|
|
state: absent
|
|
with_items:
|
|
- ntp
|
|
- ntpd
|
|
- chrony
|
|
- openntpd
|
|
- radioclk
|
|
|
|
|
|
- name: Look for /usr/bin/timedatectl command
|
|
stat:
|
|
path: /usr/bin/timedatectl
|
|
register: timedatectlcommand
|
|
|
|
|
|
- block:
|
|
|
|
- name: See if timesyncd is active
|
|
shell: 'timedatectl | grep "\(NTP enabled\|Network time on\):" | cut -d: -f 2 | grep -o "yes\|no\|n/a"'
|
|
changed_when: False
|
|
ignore_errors: True
|
|
register: timedatectl
|
|
|
|
|
|
- name: Disable timesyncd-NTProtocol
|
|
command: timedatectl set-ntp false
|
|
when: timedatectl|success and timedatectl.stdout == "yes"
|
|
|
|
|
|
- name: Stop/Disable timesyncd service
|
|
service:
|
|
name: systemd-timesyncd
|
|
enabled: False
|
|
state: stopped
|
|
when: timedatectl|success and timedatectl.stdout != "n/a"
|
|
|
|
when: timedatectlcommand.stat.exists == True
|
|
|
|
|