summaryrefslogtreecommitdiffstats
path: root/deploy/adapters/ansible/roles/common/tasks/main.yml
diff options
context:
space:
mode:
authorcarey.xu <carey.xuhan@huawei.com>2015-09-21 17:06:32 +0800
committercarey.xu <carey.xuhan@huawei.com>2015-09-22 18:01:38 +0800
commita2ea6270efc928dfb062cb32065162df4396b6a4 (patch)
tree95fff8d8e29f6e385e008edce4bd5637f30f2059 /deploy/adapters/ansible/roles/common/tasks/main.yml
parent6bd52b2de366a9c20e6c93ae7fef80f711dc6e7b (diff)
ntp configure bugfix
JIRA: COMPASS-68 Change-Id: I0ff0d382bbd9c6931cabe764f83343cfc1dbcafe Signed-off-by: carey.xu <carey.xuhan@huawei.com>
Diffstat (limited to 'deploy/adapters/ansible/roles/common/tasks/main.yml')
-rw-r--r--deploy/adapters/ansible/roles/common/tasks/main.yml15
1 files changed, 11 insertions, 4 deletions
diff --git a/deploy/adapters/ansible/roles/common/tasks/main.yml b/deploy/adapters/ansible/roles/common/tasks/main.yml
index b58bb44d..ead70aed 100644
--- a/deploy/adapters/ansible/roles/common/tasks/main.yml
+++ b/deploy/adapters/ansible/roles/common/tasks/main.yml
@@ -36,13 +36,20 @@
- 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