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