]> git.phdru.name Git - ansible.git/blobdiff - playbooks/roles/adjtimex/templates/adjtimex.sh
Feat(adjtimex): Rewrite `adjtimex.sh`
[ansible.git] / playbooks / roles / adjtimex / templates / adjtimex.sh
index 1a4d1c159de52947be957cd07e9d753fe584d788..6d97e51b2e38b0a45710cfdb45642c8501057578 100755 (executable)
@@ -1,15 +1,17 @@
 #! /bin/sh
 
-{ echo; echo; } | adjtimex -h {% if inventory_hostname == 'phdru.name' %}nl{% else %}ru{% endif %}.pool.ntp.org &&
-adjtimex -r --adjust &&
+# Warm up DNS
+host -t ns pool.ntp.org
+host pool.ntp.org
+{% if ansible_facts.os_family == 'Debian' %}
+host 0.debian.pool.ntp.org
+host 1.debian.pool.ntp.org
+host 2.debian.pool.ntp.org
+host 3.debian.pool.ntp.org
+{% endif %}
 
-freq=`adjtimex -p | awk '/frequency:/ {print $2}'` &&
-tick=`adjtimex -p | awk '/tick:/ {print $2}'` &&
-#adjtimex -f "$freq" -t "$tick" &&
+ntpdate{% if ansible_facts.os_family == 'Debian' %}-debian{% endif %} -b &&
+hwclock --systohc --update-drift &&
 
-sed -i "s/^FREQ=.\+$/FREQ=$freq/" /etc/default/adjtimex &&
-sed -i "s/^TICK=.\+$/TICK=$tick/" /etc/default/adjtimex &&
-
-ntpdate-debian &&
-hwclock --systohc &&
-{ echo; echo; } | adjtimex -h ru.pool.ntp.org
+hwclock --get &&
+exec date