diff --git a/cloud-init-templates/boothook_ubuntu.jinja2 b/cloud-init-templates/boothook_ubuntu.jinja2 index 1856843..976ab30 100644 --- a/cloud-init-templates/boothook_ubuntu.jinja2 +++ b/cloud-init-templates/boothook_ubuntu.jinja2 @@ -76,7 +76,9 @@ cloud-init-per instance sync_hwclock hwclock --systohc cloud-init-per instance edit_ntp_conf1 sed -i '/^\s*tinker panic/ d' /etc/ntp.conf cloud-init-per instance edit_ntp_conf2 sed -i '1 i tinker panic 0' /etc/ntp.conf cloud-init-per instance edit_ntp_conf_mkdir mkdir -p /var/lib/ntp -cloud-init-per instance edit_ntp_conf3 /bin/sh -c 'echo 0 | tee /var/lib/ntp/drift' +cloud-init-per instance edit_ntp_conf_chown_dir chown ntp: /var/lib/ntp +cloud-init-per instance edit_ntp_conf3 /bin/sh -c 'echo 0 | tee /var/lib/ntp/ntp.drift' +cloud-init-per instance edit_ntp_conf_chown_drift chown ntp: /var/lib/ntp/ntp.drift cloud-init-per instance edit_ntp_conf4 sed -i '/^\s*server/ d' /etc/ntp.conf cloud-init-per instance edit_ntp_conf5 /bin/sh -c 'echo "server {{ common.master_ip }} burst iburst" | tee -a /etc/ntp.conf' cloud-init-per instance start_ntp service ntp start diff --git a/contrib/fuel_bootstrap/files/trusty/etc/rc.local b/contrib/fuel_bootstrap/files/trusty/etc/rc.local index 30920c5..ed1cf8a 100755 --- a/contrib/fuel_bootstrap/files/trusty/etc/rc.local +++ b/contrib/fuel_bootstrap/files/trusty/etc/rc.local @@ -1,6 +1,3 @@ #!/bin/sh -e fix-configs-on-startup || true -flock -w 0 -o /var/lock/agent.lock -c "/usr/bin/nailgun-agent >> /var/log/nailgun-agent.log 2>&1" || true - -touch /var/lock/subsys/local diff --git a/contrib/fuel_bootstrap/files/trusty/usr/bin/fix-configs-on-startup b/contrib/fuel_bootstrap/files/trusty/usr/bin/fix-configs-on-startup index ca3b857..4803c76 100755 --- a/contrib/fuel_bootstrap/files/trusty/usr/bin/fix-configs-on-startup +++ b/contrib/fuel_bootstrap/files/trusty/usr/bin/fix-configs-on-startup @@ -1,30 +1,61 @@ #!/bin/sh +set -e -masternode_ip=`sed -rn 's/^.*url=http:\/\/(([0-9]{1,3}\.){3}[0-9]{1,3}).*$/\1/ p' /proc/cmdline` +masternode_ip=$(sed -rn 's/^.*url=http:\/\/(([0-9]{1,3}\.){3}[0-9]{1,3}).*$/\1/ p' /proc/cmdline) mco_user=$(sed 's/\ /\n/g' /proc/cmdline | grep mco_user | awk -F\= '{print $2}') mco_pass=$(sed 's/\ /\n/g' /proc/cmdline | grep mco_pass | awk -F\= '{print $2}') [ -z "$mco_user" ] && mco_user="mcollective" [ -z "$mco_pass" ] && mco_pass="marionette" # Send logs to master node. -sed -i /etc/send2syslog.conf -re "s/@MASTER_NODE_IP@/$masternode_ip/" - +cat > /etc/send2syslog.conf < /var/lib/ntp/ntp.drift +chown ntp: /var/lib/ntp/ntp.drift + # Sync clock with master node +# sed -i "/^\s*server\b/ d" /etc/ntp.conf echo "server $masternode_ip burst iburst" >> /etc/ntp.conf - service ntp restart +# # Update mcollective config +# sed -i "s/^plugin.rabbitmq.pool.1.host\b.*$/plugin.rabbitmq.pool.1.host = $masternode_ip/" /etc/mcollective/server.cfg sed -i "s/^plugin.rabbitmq.pool.1.user\b.*$/plugin.rabbitmq.pool.1.user = $mco_user/" /etc/mcollective/server.cfg sed -i "s/^plugin.rabbitmq.pool.1.password\b.*$/plugin.rabbitmq.pool.1.password= $mco_pass/" /etc/mcollective/server.cfg - service mcollective restart