ansible_public/playbooks/config/config_ntp.yaml

27 lines
656 B
YAML
Raw Permalink Normal View History

2022-06-14 18:53:16 +02:00
- hosts: '{{ variable_host | default("lab15_standard") }}'
gather_facts: no
become: yes
tasks:
- name: Install NTP
apt: package=ntp,ntpdate state=present update_cache=yes
tags: ntp
- name: Make sure NTP is stopped
service: name=ntp state=stopped enabled=yes
tags: ntp
- name: Sync time initialy
shell: ntpdate tempus1.gum.gov.pl
tags: ntp
- name: Make sure NTP is started up
service: name=ntp state=started enabled=yes
tags: ntp
- name: Sync hwclock
shell: hwclock -w
tags: ntp
handlers:
- name: restart ntpd
service: name=ntpd state=restarted