ntp.yml 620 Bytes
Newer Older
Julian Gethmann's avatar
Julian Gethmann committed
1 2
---
- name: install ntpdate
3
  package:
julian.gethmann's avatar
julian.gethmann committed
4
    state: present
5
    name: ntpdate
Julian Gethmann's avatar
Julian Gethmann committed
6 7 8 9 10 11 12 13 14
  become: yes

- name: set time server
  command: ntpdate -u ntp1.scc.kit.edu ntp2.scc.kit.edu ntp3.scc.kit.edu 0.fedora.pool.ntp.org 0.fedora.pool.ntp.org
  become: yes
  notify:
  - start ntp
  - enable ntp
  changed_when: False
15 16 17 18 19 20 21 22 23 24 25 26 27 28

- name: insert SCC into ntp configuration
  become: yes
  blockinfile:
    insertafter: ^server .*[a-z]+.*$
    path: /etc/ntp.conf
    backup: yes
    state: present
    block: |
      server ntp1.scc.kit.edu
      server ntp2.scc.kit.edu
      server ntp3.scc.kit.edu
      server ntp4.scc.kit.edu
  tags: ntp