ntp configure bugfix 49/1849/2
authorcarey.xu <carey.xuhan@huawei.com>
Mon, 21 Sep 2015 09:06:32 +0000 (17:06 +0800)
committercarey.xu <carey.xuhan@huawei.com>
Tue, 22 Sep 2015 10:01:38 +0000 (18:01 +0800)
JIRA: COMPASS-68
Change-Id: I0ff0d382bbd9c6931cabe764f83343cfc1dbcafe
Signed-off-by: carey.xu <carey.xuhan@huawei.com>
deploy/adapters/ansible/roles/common/tasks/main.yml
deploy/adapters/ansible/roles/common/templates/ntp.conf
deploy/adapters/ansible/roles/setup-network/files/setup_networks/net_init
deploy/adapters/ansible/roles/setup-network/tasks/main.yml

index b58bb44..ead70ae 100644 (file)
 - name: update pip.conf
   template: src=pip.conf dest=~/.pip/pip.conf
 
-- name: sync between sys clock and hard clock
-  command: su -s /bin/sh -c "service {{ ntp_service }} stop; ntpd -gq; hwclock --systohc"
-  ignore_errors: True
-
 - name: update ntp conf
   template: src=ntp.conf dest=/etc/ntp.conf backup=yes
 
+- name: stop ntp
+  service: name={{ ntp_service }} state=stopped enabled=yes
+
+- name: use ntpdate once for initial sync time
+  shell: ntpdate {{ ntp_server }}
+  ignore_errors: True
+
+- name: sync sys clock to hard clock
+  shell: hwclock --systohc
+  ignore_errors: True
+
 - name: restart ntp
   service: name={{ ntp_service }} state=restarted enabled=yes
 
index c613809..2d560be 100644 (file)
@@ -16,14 +16,12 @@ filegen clockstats file clockstats type day enable
 # Use servers from the NTP Pool Project. Approved by Ubuntu Technical Board
 # on 2011-02-08 (LP: #104525). See http://www.pool.ntp.org/join.html for
 # more information.
-server {{ NTP_SERVER_LOCAL }}
-server 0.ubuntu.pool.ntp.org
-server 1.ubuntu.pool.ntp.org
-server 2.ubuntu.pool.ntp.org
-server 3.ubuntu.pool.ntp.org
+server {{ ntp_server }}
+server {{ internal_vip.ip }}
 
-# Use Ubuntu's ntp server as a fallback.
-server ntp.ubuntu.com
+# Use local server as a fallback.
+server  127.127.1.0     # local clock
+fudge   127.127.1.0 stratum 10
 
 # Access control configuration; see /usr/share/doc/ntp-doc/html/accopt.html for
 # details.  The web page <http://support.ntp.org/bin/view/Support/AccessRestrictions>
@@ -34,8 +32,8 @@ server ntp.ubuntu.com
 # up blocking replies from your own upstream servers.
 
 # By default, exchange time with everybody, but don't allow configuration.
-restrict -4 default kod notrap nomodify nopeer noquery
-restrict -6 default kod notrap nomodify nopeer noquery
+restrict -4 default kod notrap nomodify
+restrict -6 default kod notrap nomodify
 
 # Local users may interrogate the ntp server more closely.
 restrict 127.0.0.1
index a74a006..c27a8bf 100755 (executable)
@@ -12,7 +12,7 @@
 #
 # anamon.init: Starts the cobbler post-install boot notification program
 #
-# chkconfig: 35 95 95
+# chkconfig: 35 0 6
 #
 # description: anamon runs the first time a machine is booted after
 #              installation.
index 689e6e3..8667a9b 100644 (file)
@@ -41,5 +41,4 @@
   shell: python /opt/setup_networks/setup_networks.py
 
 - name: add to boot scripts
-  shell: update-rc.d net_init defaults 0 6
-  when: ansible_os_family == "Debian"
+  service: name=net_init enabled=yes