ntp.yml 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. ---
  2. - name: deploy ntp servers
  3. block:
  4. - name: deploy ntpd
  5. package:
  6. name: ntp
  7. state: present
  8. - name: deploy ntpdate
  9. package:
  10. name: ntpdate
  11. state: present
  12. - name: update ntp servers
  13. template:
  14. src: ntp.conf.j2
  15. dest: /etc/ntp.conf
  16. owner: root
  17. group: root
  18. mode: u=rw,g=r,o=r
  19. backup: yes
  20. notify:
  21. - restart ntpd
  22. - sync ntp clocks
  23. when: ( ansible_distribution == "CentOS" or ansible_distribution == "RedHat" ) and ansible_distribution_major_version | int < 8
  24. - name: deploy chrony server
  25. block:
  26. - name: deploy chrony
  27. package:
  28. name: chrony
  29. state: present
  30. - name: update ntp servers
  31. template:
  32. src: chrony.conf.j2
  33. dest: /etc/chrony.conf
  34. owner: root
  35. group: root
  36. mode: u=rw,g=r,o=r
  37. backup: yes
  38. notify:
  39. - restart chrony
  40. - sync chrony sources
  41. when: ( ansible_distribution == "CentOS" or ansible_distribution == "RedHat" ) and ansible_distribution_major_version | int > 7