|
|
@ -143,11 +143,9 @@ seed_checkin() (
|
|
|
|
action="install-complete"
|
|
|
|
action="install-complete"
|
|
|
|
;;
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
esac
|
|
|
|
macaddr=$( ip -br link show ${target_interface} | awk '{ print $3 }' )
|
|
|
|
|
|
|
|
ipaddr=$( ip -br address show ${target_interface} | awk '{ print $3 }' | awk -F '/' '{ print $1 }' )
|
|
|
|
|
|
|
|
curl -X POST \
|
|
|
|
curl -X POST \
|
|
|
|
-H "Content-Type: application/json" \
|
|
|
|
-H "Content-Type: application/json" \
|
|
|
|
-d "{\"action\":\"${action}\",\"macaddr\":\"${macaddr}\",\"ipaddr\":\"${ipaddr}\",\"hostname\":\"${target_hostname}\",\"bmc_macaddr\":\"${bmc_macaddr}\",\"bmc_ipaddr\":\"${bmc_ipaddr}\"}" \
|
|
|
|
-d "{\"action\":\"${action}\",\"hostname\":\"${target_hostname}\",\"host_macaddr\":\"${host_macaddr}\",\"host_ipaddr\":\"${host_ipaddr}\",\"bmc_macaddr\":\"${bmc_macaddr}\",\"bmc_ipaddr\":\"${bmc_ipaddr}\"}" \
|
|
|
|
${pvcbootstrapd_checkin_uri} >&2
|
|
|
|
${pvcbootstrapd_checkin_uri} >&2
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
@ -209,6 +207,9 @@ seed_config() {
|
|
|
|
target_route="$( ip route show to match ${seed_host} | grep 'scope link' )"
|
|
|
|
target_route="$( ip route show to match ${seed_host} | grep 'scope link' )"
|
|
|
|
target_interface="$( grep -E -o 'e[a-z]+[0-9]+[a-z0-9]*' <<<"${target_route}" )"
|
|
|
|
target_interface="$( grep -E -o 'e[a-z]+[0-9]+[a-z0-9]*' <<<"${target_route}" )"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
host_macaddr=$( ip -br link show ${target_interface} | awk '{ print $3 }' )
|
|
|
|
|
|
|
|
host_ipaddr=$( ip -br address show ${target_interface} | awk '{ print $3 }' | awk -F '/' '{ print $1 }' )
|
|
|
|
|
|
|
|
|
|
|
|
# Handle the target disk
|
|
|
|
# Handle the target disk
|
|
|
|
if [[ -n ${target_disk_path} ]]; then
|
|
|
|
if [[ -n ${target_disk_path} ]]; then
|
|
|
|
target_disk="$( realpath ${target_disk_path} )"
|
|
|
|
target_disk="$( realpath ${target_disk_path} )"
|
|
|
@ -834,31 +835,30 @@ case ${install_option} in
|
|
|
|
#!/usr/bin/env bash
|
|
|
|
#!/usr/bin/env bash
|
|
|
|
target_interface=\${1}
|
|
|
|
target_interface=\${1}
|
|
|
|
pvcbootstrapd_checkin_uri="${pvcbootstrapd_checkin_uri}"
|
|
|
|
pvcbootstrapd_checkin_uri="${pvcbootstrapd_checkin_uri}"
|
|
|
|
macaddr=\$( ip -br link show \${target_interface} | awk '{ print \$3 }' )
|
|
|
|
host_macaddr=\$( ip -br link show \${target_interface} | awk '{ print \$3 }' )
|
|
|
|
ipaddr=\$( ip -br address show \${target_interface} | awk '{ print \$3 }' | awk -F '/' '{ print \$1 }' )
|
|
|
|
host_ipaddr=\$( ip -br address show \${target_interface} | awk '{ print \$3 }' | awk -F '/' '{ print \$1 }' )
|
|
|
|
bmc_macaddr=\$( ipmitool lan print | grep 'MAC Address ' | awk '{ print \$NF }' )
|
|
|
|
bmc_macaddr=\$( ipmitool lan print | grep 'MAC Address ' | awk '{ print \$NF }' )
|
|
|
|
bmc_ipaddr=\$( ipmitool lan print | grep 'IP Address ' | awk '{ print \$NF }' )
|
|
|
|
bmc_ipaddr=\$( ipmitool lan print | grep 'IP Address ' | awk '{ print \$NF }' )
|
|
|
|
if [[ -f /etc/pvc-install.pvcbootstrapd_completed ]]; then
|
|
|
|
if [[ -f /etc/pvc-install.hooks ]]; then
|
|
|
|
# The third boot, when all pvcprovisionerd plugins have been run (this script will henceforth do nothing)
|
|
|
|
# The third boot, when all hooks have been completed
|
|
|
|
action="system-boot_bootstrap-completed"
|
|
|
|
action="system-boot_completed"
|
|
|
|
elif [[ -f /etc/pvc-install.base && -f /etc/pvc-install.pvc ]]; then
|
|
|
|
elif [[ -f /etc/pvc-install.base && -f /etc/pvc-install.pvc ]]; then
|
|
|
|
# The second boot, when Ansible has been run and plugins running
|
|
|
|
# The second boot, when Ansible has configured the cluster
|
|
|
|
action="system-boot_ansible-completed"
|
|
|
|
action="system-boot_configured"
|
|
|
|
touch /etc/pvc-install.pvcbootstrapd_completed
|
|
|
|
|
|
|
|
else
|
|
|
|
else
|
|
|
|
# The first boot, when Ansible has not been run yet
|
|
|
|
# The first boot, when Ansible has not been run yet
|
|
|
|
action="system-boot_initial"
|
|
|
|
action="system-boot_initial"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
curl -X POST \
|
|
|
|
curl -X POST \
|
|
|
|
-H "Content-Type: application/json" \
|
|
|
|
-H "Content-Type: application/json" \
|
|
|
|
-d "{\"action\":\"\${action}\",\"macaddr\":\"\${macaddr}\",\"ipaddr\":\"\${ipaddr}\",\"hostname\":\"\$( hostname -s )\",\"bmc_macaddr\":\"\${bmc_macaddr}\",\"bmc_ipaddr\":\"\${bmc_ipaddr}\"}" \
|
|
|
|
-d "{\"action\":\"\${action}\",\"hostname\":\"\$( hostname -s )\",\"host_macaddr\":\"\${host_macaddr}\",\"host_ipaddr\":\"\${host_ipaddr}\",\"bmc_macaddr\":\"\${bmc_macaddr}\",\"bmc_ipaddr\":\"\${bmc_ipaddr}\"}" \
|
|
|
|
\${pvcbootstrapd_checkin_uri}
|
|
|
|
\${pvcbootstrapd_checkin_uri}
|
|
|
|
|
|
|
|
|
|
|
|
if [[ -f /etc/pvc-install.pvcbootstrapd_completed ]]; then
|
|
|
|
if [[ \${action} == "system-boot_completed" ]]; then
|
|
|
|
# Clean up the bootstrap interface and this script
|
|
|
|
# Clean up the bootstrap interface and this script
|
|
|
|
rm /etc/network/interfaces.d/\${target_interface}
|
|
|
|
rm /etc/network/interfaces.d/\${target_interface}
|
|
|
|
rm \$0
|
|
|
|
rm \$0
|
|
|
|
exit 0
|
|
|
|
poweroff
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
EOF
|
|
|
|
EOF
|
|
|
|
chmod +x ${target}/etc/network/pvcprovisionerd.checkin.sh
|
|
|
|
chmod +x ${target}/etc/network/pvcprovisionerd.checkin.sh
|
|
|
|