Repos with recipes to deploy some infrastructure services
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

41 lines
1.1 KiB

  1. ---
  2. - name: Include OS-specific variables.
  3. include_vars: "{{ ansible_facts.os_family }}.yml"
  4. - name: install ntp
  5. apt:
  6. name:
  7. - "{{ ntp_package | default('ntp', true) }}"
  8. update_cache: true
  9. state: present
  10. when: ansible_facts.os_family == "Debian"
  11. - name: install ntp
  12. yum:
  13. name:
  14. - "{{ ntp_package | default('ntp', true) }}"
  15. update_cache: true
  16. state: present
  17. when: ansible_facts.os_family == "RedHat"
  18. - name: Ensure log dir exist
  19. file:
  20. state: directory
  21. path: "{{ logfile | dirname }}"
  22. - name: Ensure drift dir exist
  23. file:
  24. state: directory
  25. path: "{{ driftfile | dirname }}"
  26. - name: set ntp configuration
  27. template:
  28. src: "{{ ntp_package }}.conf.j2"
  29. dest: "{{ ntp_conf_file | default('/etc/ntp.conf', true) }}"
  30. owner: root
  31. group: root
  32. mode: '0640'
  33. - name: Set and start ntp service
  34. service:
  35. enabled: true
  36. name: "{{ ntp_daemon | default('ntpd', true) }}"
  37. state: restarted
  38. - name: Show status service
  39. shell: "systemctl status {{ ntp_daemon }}.service"
  40. ...