2020-07-23 16:29:43 +00:00
|
|
|
#!/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.
|
|
|
|
|
|
|
|
nodename=$(grep ^NODENAME /etc/confluent/confluent.info|awk '{print $2}')
|
2021-05-03 16:48:08 +00:00
|
|
|
confluent_apikey=$(cat /etc/confluent/confluent.apikey)
|
2021-09-13 14:23:13 +00:00
|
|
|
confluent_mgr=$(grep ^deploy_server: /etc/confluent/confluent.deploycfg|awk '{print $2}')
|
2021-05-03 16:48:08 +00:00
|
|
|
confluent_profile=$(grep ^profile: /etc/confluent/confluent.deploycfg|awk '{print $2}')
|
|
|
|
export nodename confluent_mgr confluent_profile
|
2020-07-23 16:29:43 +00:00
|
|
|
. /etc/confluent/functions
|
2021-08-09 19:19:36 +00:00
|
|
|
while ! ping -c 1 $confluent_mgr >& /dev/null; do
|
|
|
|
sleep 1
|
|
|
|
done
|
2021-04-30 18:08:42 +00:00
|
|
|
exec >> /var/log/confluent/confluent-firstboot.log
|
2021-05-03 12:57:59 +00:00
|
|
|
exec 2>> /var/log/confluent/confluent-firstboot.log
|
2021-12-07 12:21:04 +00:00
|
|
|
chmod 600 /var/log/confluent/confluent-firstboot.log
|
2021-04-30 18:08:42 +00:00
|
|
|
tail -f /var/log/confluent/confluent-firstboot.log > /dev/console &
|
|
|
|
logshowpid=$!
|
2020-07-23 16:29:43 +00:00
|
|
|
|
2021-04-29 13:20:24 +00:00
|
|
|
if [ ! -f /etc/confluent/firstboot.ran ]; then
|
|
|
|
touch /etc/confluent/firstboot.ran
|
2020-07-23 16:29:43 +00:00
|
|
|
|
2021-04-29 13:20:24 +00:00
|
|
|
cat /etc/confluent/tls/*.pem >> /etc/pki/tls/certs/ca-bundle.crt
|
2020-07-23 16:29:43 +00:00
|
|
|
|
2021-04-29 13:20:24 +00:00
|
|
|
run_remote firstboot.custom
|
|
|
|
# Firstboot scripts may be placed into firstboot.d, e.g. firstboot.d/01-firstaction.sh, firstboot.d/02-secondaction.sh
|
2021-05-03 16:48:08 +00:00
|
|
|
run_remote_parts firstboot.d
|
2020-07-23 16:29:43 +00:00
|
|
|
|
2021-04-29 13:20:24 +00:00
|
|
|
# Induce execution of remote configuration, e.g. ansible plays in ansible/firstboot.d/
|
2021-05-03 16:48:08 +00:00
|
|
|
run_remote_config firstboot.d
|
2021-04-29 13:20:24 +00:00
|
|
|
fi
|
2021-04-23 13:08:50 +00:00
|
|
|
|
2021-05-03 16:48:08 +00:00
|
|
|
curl -X POST -d 'status: complete' -H "CONFLUENT_NODENAME: $nodename" -H "CONFLUENT_APIKEY: $confluent_apikey" https://$confluent_mgr/confluent-api/self/updatestatus
|
2020-07-23 16:29:43 +00:00
|
|
|
systemctl disable firstboot
|
|
|
|
rm /etc/systemd/system/firstboot.service
|
2021-04-29 13:20:24 +00:00
|
|
|
rm /etc/confluent/firstboot.ran
|
2021-05-03 12:57:59 +00:00
|
|
|
kill $logshowpid
|