Skip to content

Commit

Permalink
Merge branch 'add_ntp_task' into 'master'
Browse files Browse the repository at this point in the history
fix easzlab#2: Add ntp task

Closes easzlab#2

See merge request nchc-ai/kubeasz!1
  • Loading branch information
Chia Chuan Chuang committed Apr 12, 2018
2 parents 0686b07 + 226fd52 commit de1a2c9
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions 01.prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
- lb
roles:
- prepare
- ntp

# [可选]多master部署时的负载均衡配置
- hosts: lb
Expand Down
1 change: 1 addition & 0 deletions 90.setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
- lb
roles:
- prepare
- ntp

# [可选]多master部署时的负载均衡配置
- hosts: lb
Expand Down
23 changes: 23 additions & 0 deletions roles/ntp/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
- name: Set timezone
timezone:
name: "Asia/Taipei"

- name: Install ntpdate
package:
name: ntpdate
state: present

- name: Sync time initialy
shell: /usr/sbin/ntpdate tock.stdtime.gov.tw

- name: Sync hwclock
shell: hwclock -w

- name: add time sync crontab entry
cron:
name : sync datetime
job : (/usr/sbin/ntpdate tock.stdtime.gov.tw && /sbin/hwclock -w) &> /dev/null
user: root
hour: 3
cron_file: ansible_sync_time
state: present

0 comments on commit de1a2c9

Please sign in to comment.