main.yml 905 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. ---
  2. - name: Deinstall NTProtocol package(s)
  3. package:
  4. name: "{{ item }}"
  5. state: absent
  6. with_items:
  7. - ntp
  8. - ntpd
  9. - chrony
  10. - openntpd
  11. - radioclk
  12. - name: Look for /usr/bin/timedatectl command
  13. stat:
  14. path: /usr/bin/timedatectl
  15. register: timedatectlcommand
  16. - block:
  17. - name: See if timesyncd is active
  18. shell: 'timedatectl | grep "\(NTP enabled\|Network time on\):" | cut -d: -f 2 | grep -o "yes\|no\|n/a"'
  19. changed_when: False
  20. ignore_errors: True
  21. register: timedatectl
  22. - name: Disable timesyncd-NTProtocol
  23. command: timedatectl set-ntp false
  24. when: timedatectl|success and timedatectl.stdout == "yes"
  25. - name: Stop/Disable timesyncd service
  26. service:
  27. name: systemd-timesyncd
  28. enabled: False
  29. state: stopped
  30. when: timedatectl|success and timedatectl.stdout != "n/a"
  31. when: timedatectlcommand.stat.exists == True