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)
|
- name: Deinstall NTProtocol package(s)
|
||||||
package:
|
package:
|
||||||
name: "{{ item }}"
|
name: "{{ timesync_packages_deinstall }}"
|
||||||
state: absent
|
state: absent
|
||||||
with_items:
|
|
||||||
- ntp
|
|
||||||
- ntpd
|
|
||||||
- chrony
|
|
||||||
- openntpd
|
|
||||||
- radioclk
|
|
||||||
|
|
||||||
|
|
||||||
- name: Look for /usr/bin/timedatectl command
|
- name: Look for /usr/bin/timedatectl command
|
||||||
|
@ -17,10 +11,11 @@
|
||||||
register: timedatectlcommand
|
register: timedatectlcommand
|
||||||
|
|
||||||
|
|
||||||
- block:
|
- name: Only with timedatectl
|
||||||
|
block:
|
||||||
|
|
||||||
- name: See if timesyncd is active
|
- 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
|
changed_when: False
|
||||||
ignore_errors: True
|
ignore_errors: True
|
||||||
register: timedatectl
|
register: timedatectl
|
||||||
|
@ -28,7 +23,7 @@
|
||||||
|
|
||||||
- name: Disable timesyncd-NTProtocol
|
- name: Disable timesyncd-NTProtocol
|
||||||
command: timedatectl set-ntp false
|
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
|
- name: Stop/Disable timesyncd service
|
||||||
|
@ -36,7 +31,7 @@
|
||||||
name: systemd-timesyncd
|
name: systemd-timesyncd
|
||||||
enabled: False
|
enabled: False
|
||||||
state: stopped
|
state: stopped
|
||||||
when: timedatectl|success and timedatectl.stdout != "n/a"
|
when: timedatectl is success and timedatectl.stdout != "n/a"
|
||||||
|
|
||||||
when: timedatectlcommand.stat.exists == True
|
when: timedatectlcommand.stat.exists == True
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue