Fix ntpd start on centos in cloud-init boothook
1) Add forgottent ntpd start into centos's cloud-init boothook. 2) Toggle ntp server on ubuntu to be sure it will start with correct settings. 3) Fix typo in both boothook files ntp(d) must be stopped before syncing date with ntpdate. Change-Id: I4e8e912b61a57c84e24e13be10983654bcfec0ab Closes-Bug: #1394617
This commit is contained in:
parent
93699cb464
commit
f762f03ecc
@ -67,7 +67,8 @@ cloud-init-per instance set_limits echo -e "* soft core unlimited\n* hard core u
|
||||
#cloud-init-per instance dhclient echo 'supersede routers 0;' | tee /etc/dhcp/dhclient.conf
|
||||
|
||||
# ntp sync
|
||||
cloud-init-per instance service ntp stop | tee /dev/null
|
||||
# '| tee /dev/null' is needed for returning zero execution code always
|
||||
cloud-init-per instance stop_ntpd service ntpd stop | tee /dev/null
|
||||
cloud-init-per instance sync_date ntpdate -t 4 -b {{ common.master_ip }}
|
||||
cloud-init-per instance sync_hwclock hwclock --systohc
|
||||
|
||||
@ -83,6 +84,7 @@ cloud-init-per instance edit_ntp_conf6 echo "server {{ common.master_ip }} burst
|
||||
cloud-init-per instance set_ntpdate sed -i 's/SYNC_HWCLOCK\s*=\s*no/SYNC_HWCLOCK=yes/' /etc/sysconfig/ntpdate
|
||||
cloud-init-per instance set_ntpd_0 chkconfig ntpd on
|
||||
cloud-init-per instance set_ntpd_1 chkconfig ntpdate on
|
||||
cloud-init-per instance start_ntpd service ntpd start
|
||||
|
||||
cloud-init-per instance removeUseDNS sed -i --follow-symlinks -e '/UseDNS/d' /etc/ssh/sshd_config
|
||||
add_str_to_file_if_not_exists /etc/ssh/sshd_config 'UseDNS' 'UseDNS no'
|
||||
|
@ -52,7 +52,8 @@ cloud-init-per instance conntrack_max_set sysctl -w "net.nf_conntrack_max=104857
|
||||
cloud-init-per instance dhclient echo 'supersede routers 0;' | tee /etc/dhcp/dhclient.conf
|
||||
|
||||
# ntp sync
|
||||
cloud-init-per instance service ntp stop | tee /dev/null
|
||||
# '| tee /dev/null' is needed for returning zero execution code always
|
||||
cloud-init-per instance stop_ntp service ntp stop | tee /dev/null
|
||||
cloud-init-per instance sync_date ntpdate -t 4 -b {{ common.master_ip }}
|
||||
cloud-init-per instance sync_hwclock hwclock --systohc
|
||||
|
||||
@ -61,6 +62,7 @@ cloud-init-per instance edit_ntp_conf2 sed -i '1 i tinker panic 0' /etc/ntp.conf
|
||||
cloud-init-per instance edit_ntp_conf3 echo 0 > /var/lib/ntp/drift
|
||||
cloud-init-per instance edit_ntp_conf4 sed -i '/^\s*server/ d' /etc/ntp.conf
|
||||
cloud-init-per instance edit_ntp_conf5 echo "server {{ common.master_ip }} burst iburst" | tee -a /etc/ntp.conf
|
||||
cloud-init-per instance start_ntp service ntp start
|
||||
|
||||
cloud-init-per instance removeUseDNS sed -i --follow-symlinks -e '/UseDNS/d' /etc/ssh/sshd_config
|
||||
add_str_to_file_if_not_exists /etc/ssh/sshd_config 'UseDNS' 'UseDNS no'
|
||||
|
Loading…
Reference in New Issue
Block a user