2021-07-21 16:47:43 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# This script is executed 'chrooted' into a cloned disk target before rebooting
|
2021-07-21 20:48:38 +00:00
|
|
|
#
|
2021-07-21 16:47:43 +00:00
|
|
|
|
|
|
|
nodename=$(grep ^NODENAME /etc/confluent/confluent.info|awk '{print $2}')
|
|
|
|
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-07-21 16:47:43 +00:00
|
|
|
confluent_profile=$(grep ^profile: /etc/confluent/confluent.deploycfg|awk '{print $2}')
|
|
|
|
export nodename confluent_mgr confluent_profile
|
|
|
|
. /etc/confluent/functions
|
|
|
|
mkdir -p /var/log/confluent
|
2021-12-08 12:42:19 +00:00
|
|
|
chmod 700 /var/log/confluent
|
2021-07-21 16:47:43 +00:00
|
|
|
exec >> /var/log/confluent/confluent-post.log
|
|
|
|
exec 2>> /var/log/confluent/confluent-post.log
|
2021-12-07 12:21:04 +00:00
|
|
|
chmod 600 /var/log/confluent/confluent-post.log
|
2021-07-21 16:47:43 +00:00
|
|
|
tail -f /var/log/confluent/confluent-post.log > /dev/console &
|
|
|
|
logshowpid=$!
|
|
|
|
curl -f https://$confluent_mgr/confluent-public/os/$confluent_profile/scripts/firstboot.service > /etc/systemd/system/firstboot.service
|
|
|
|
mkdir -p /opt/confluent/bin
|
|
|
|
curl -f https://$confluent_mgr/confluent-public/os/$confluent_profile/scripts/firstboot.sh > /opt/confluent/bin/firstboot.sh
|
|
|
|
chmod +x /opt/confluent/bin/firstboot.sh
|
2021-07-21 20:48:38 +00:00
|
|
|
systemctl enable firstboot
|
2021-07-21 21:34:53 +00:00
|
|
|
selinuxpolicy=$(grep ^SELINUXTYPE /etc/selinux/config |awk -F= '{print $2}')
|
|
|
|
if [ ! -z "$selinuxpolicy" ]; then
|
|
|
|
setfiles /etc/selinux/${selinuxpolicy}/contexts/files/file_contexts /etc/
|
|
|
|
fi
|
2021-07-26 17:29:33 +00:00
|
|
|
run_remote_python syncfileclient
|
2021-07-21 16:47:43 +00:00
|
|
|
run_remote post.custom
|
|
|
|
# post scripts may be placed into post.d, e.g. post.d/01-firstaction.sh, post.d/02-secondaction.sh
|
|
|
|
run_remote_parts post.d
|
|
|
|
|
|
|
|
# Induce execution of remote configuration, e.g. ansible plays in ansible/post.d/
|
|
|
|
run_remote_config post.d
|
|
|
|
|
2021-07-21 21:44:43 +00:00
|
|
|
curl -sf -X POST -d 'status: staged' -H "CONFLUENT_NODENAME: $nodename" -H "CONFLUENT_APIKEY: $confluent_apikey" https://$confluent_mgr/confluent-api/self/updatestatus
|
2021-07-21 16:47:43 +00:00
|
|
|
|
|
|
|
kill $logshowpid
|
|
|
|
|