mirror of
https://github.com/xcat2/confluent.git
synced 2024-11-25 11:01:09 +00:00
789376029d
Fix various callbacks when using IPv6 based deployment. Do not attempt to restore erroneously cloned zram partitions. Convert LVM names to new LVM names consistent with source naming scheme. Push new kernel command line into /boot/loader and /etc/kernel/cmdline.
50 lines
2.0 KiB
Bash
50 lines
2.0 KiB
Bash
#!/bin/sh
|
|
|
|
# This script is executed on the first boot after install has
|
|
# completed. It is best to edit the middle of the file as
|
|
# noted below so custom commands are executed before
|
|
# the script notifies confluent that install is fully complete.
|
|
|
|
HOME=$(getent passwd $(whoami)|cut -d: -f 6)
|
|
export HOME
|
|
nodename=$(grep ^NODENAME /etc/confluent/confluent.info|awk '{print $2}')
|
|
confluent_apikey=$(cat /etc/confluent/confluent.apikey)
|
|
confluent_mgr=$(grep ^deploy_server_v6: /etc/confluent/confluent.deploycfg|awk '{print $2}')
|
|
if [ -z "$confluent_mgr" ] || [ "$confluent_mgr" == "null" ] || ! ping -c 1 $confluent_mgr >& /dev/null; then
|
|
confluent_mgr=$(grep ^deploy_server: /etc/confluent/confluent.deploycfg|awk '{print $2}')
|
|
fi
|
|
confluent_websrv=$confluent_mgr
|
|
if [[ "$confluent_mgr" == *:* ]]; then
|
|
confluent_websrv="[$confluent_mgr]"
|
|
fi
|
|
confluent_profile=$(grep ^profile: /etc/confluent/confluent.deploycfg|awk '{print $2}')
|
|
export nodename confluent_mgr confluent_profile confluent_websrv
|
|
. /etc/confluent/functions
|
|
(
|
|
exec >> /var/log/confluent/confluent-firstboot.log
|
|
exec 2>> /var/log/confluent/confluent-firstboot.log
|
|
chmod 600 /var/log/confluent/confluent-firstboot.log
|
|
while ! ping -c 1 $confluent_mgr >& /dev/null; do
|
|
sleep 1
|
|
done
|
|
|
|
if [ ! -f /etc/confluent/firstboot.ran ]; then
|
|
touch /etc/confluent/firstboot.ran
|
|
|
|
cat /etc/confluent/tls/*.pem >> /etc/pki/tls/certs/ca-bundle.crt
|
|
|
|
run_remote firstboot.custom
|
|
# Firstboot scripts may be placed into firstboot.d, e.g. firstboot.d/01-firstaction.sh, firstboot.d/02-secondaction.sh
|
|
run_remote_parts firstboot.d
|
|
|
|
# Induce execution of remote configuration, e.g. ansible plays in ansible/firstboot.d/
|
|
run_remote_config firstboot.d
|
|
fi
|
|
|
|
curl -X POST -d 'status: complete' -H "CONFLUENT_NODENAME: $nodename" -H "CONFLUENT_APIKEY: $confluent_apikey" https://$confluent_websrv/confluent-api/self/updatestatus
|
|
systemctl disable firstboot
|
|
rm /etc/systemd/system/firstboot.service
|
|
rm /etc/confluent/firstboot.ran
|
|
) &
|
|
tail --pid $! -F /var/log/confluent/confluent-firstboot.log > /dev/console
|