Small fixes to timesync-disabled
This commit is contained in:
parent
cbd11ab12b
commit
b3e6c6a05a
8
roles/timesync-disabled/defaults/main.yml
Normal file
8
roles/timesync-disabled/defaults/main.yml
Normal file
|
@ -0,0 +1,8 @@
|
|||
---
|
||||
timesync_packages_deinstall:
|
||||
- ntp
|
||||
- ntpd
|
||||
- chrony
|
||||
- openntpd
|
||||
- radioclk
|
||||
|
|
@ -1,14 +1,8 @@
|
|||
---
|
||||
- name: Deinstall NTProtocol package(s)
|
||||
package:
|
||||
name: "{{ item }}"
|
||||
name: "{{ timesync_packages_deinstall }}"
|
||||
state: absent
|
||||
with_items:
|
||||
- ntp
|
||||
- ntpd
|
||||
- chrony
|
||||
- openntpd
|
||||
- radioclk
|
||||
|
||||
|
||||
- name: Look for /usr/bin/timedatectl command
|
||||
|
@ -17,10 +11,11 @@
|
|||
register: timedatectlcommand
|
||||
|
||||
|
||||
- block:
|
||||
- name: Only with timedatectl
|
||||
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"'
|
||||
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
|
||||
|
@ -28,7 +23,7 @@
|
|||
|
||||
- name: Disable timesyncd-NTProtocol
|
||||
command: timedatectl set-ntp false
|
||||
when: timedatectl|success and timedatectl.stdout == "yes"
|
||||
when: timedatectl is success and timedatectl.stdout in ["active", "yes"]
|
||||
|
||||
|
||||
- name: Stop/Disable timesyncd service
|
||||
|
@ -36,7 +31,7 @@
|
|||
name: systemd-timesyncd
|
||||
enabled: False
|
||||
state: stopped
|
||||
when: timedatectl|success and timedatectl.stdout != "n/a"
|
||||
when: timedatectl is success and timedatectl.stdout != "n/a"
|
||||
|
||||
when: timedatectlcommand.stat.exists == True
|
||||
|
||||
|
|
Loading…
Reference in a new issue