2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-12-25 12:41:39 +00:00

Rework genesis with more output and an onboot.sh

This commit is contained in:
Jarrod Johnson 2020-08-11 18:11:48 -04:00
parent 1ceb588ad4
commit 43ce1b17a7
2 changed files with 36 additions and 17 deletions

View File

@ -1,36 +1,40 @@
#!/bin/bash
export LANG=en_US.utf8
mkdir -p /etc/confluent
/usr/lib/systemd/systemd-udevd --daemon
udevadm trigger
udevadm trigger --type=devices --action=add
udevadm settle
cat > /etc/ssh/sshd_config << EOF
PermitRootLogin yes
AuthorizedKeysFile .ssh/authorized_keys
EOF
modprobe ib_ipoib
modprobe ib_umad
modprobe hfi1
modprobe mlx5_ib
mkdir ~/.ssh
cat /ssh/*.rootpubkey > ~/.ssh/authorized_keys
cat /tls/*.pem > /etc/confluent/ca.pem
if ! grep console= /proc/cmdline >& /dev/null; then
autocons=$(/opt/confluent/bin/autocons)
echo console=$autocons |sed -e 's!/dev/!!' >> /tmp/01-autocons.conf
autocons=${autocons%,*}
echo $autocons > /tmp/01-autocons.devnode
if [ ! -z "$autocons" ]; then
echo "Using console $(cat /tmp/01-autocons.conf)"
echo "Using $(cat /tmp/01-autocons.conf)"
tmux a <> $autocons >&0 2>&1 &
fi
else
tmux a <> /dev/tty1 >&0 2>&1 &
fi
echo -n "udevd: "
/usr/lib/systemd/systemd-udevd --daemon
echo -n "Loading drivers..."
udevadm trigger
udevadm trigger --type=devices --action=add
udevadm settle
modprobe ib_ipoib
modprobe ib_umad
modprobe hfi1
modprobe mlx5_ib
echo "done"
cat > /etc/ssh/sshd_config << EOF
PermitRootLogin yes
AuthorizedKeysFile .ssh/authorized_keys
EOF
mkdir ~/.ssh
cat /ssh/*.rootpubkey > ~/.ssh/authorized_keys
cat /tls/*.pem > /etc/confluent/ca.pem
TRIES=0
touch /etc/confluent/confluent.info
cd /sys/class/net
echo -n "Scanning for network configuration..."
while ! grep ^EXTMGRINFO: /etc/confluent/confluent.info | awk -F'|' '{print $3}' | grep 1 >& /dev/null && [ "$TRIES" -lt 30 ]; do
TRIES=$((TRIES + 1))
for i in *; do
@ -39,7 +43,6 @@ while ! grep ^EXTMGRINFO: /etc/confluent/confluent.info | awk -F'|' '{print $3}'
/opt/confluent/bin/copernicus -t > /etc/confluent/confluent.info
done
cd /
ip addr|grep inet |awk '{print $2}' | sed -e 's!/.*!!'
nodename=$(grep ^NODENAME /etc/confluent/confluent.info|awk '{print $2}')
hostname $nodename
/usr/libexec/platform-python /opt/confluent/bin/apiclient /confluent-api/self/deploycfg > /etc/confluent/confluent.deploycfg
@ -67,6 +70,7 @@ else
ip route add default via $v4gw
fi
fi
echo -n "Initialiing ssh..."
ssh-keygen -A
for pubkey in /etc/ssh/ssh_host*key.pub; do
certfile=${pubkey/.pub/-cert.pub}
@ -76,6 +80,13 @@ for pubkey in /etc/ssh/ssh_host*key.pub; do
echo HostKey $privfile >> /etc/ssh/sshd_config
done
/usr/sbin/sshd
profile=$(grep ^profile: /etc/confluent/confuent.deploycfg | awk '{print $2}')
mgr=$(grep ^deploy_server: /etc/confluent/confluent.deploycfg | awk '{print $2}')
export profile mgr
echo "Running https://$mgr/confluent-public/os/$profile/scripts/boot.sh"
/usr/libexec/platform-python /opt/confluent/bin/apiclient /confluent-public/os/$profile/scripts/functions > /tmp/functions
. /tmp/functions
run_remote onboot.sh
while :; do
bash
done

View File

@ -0,0 +1,8 @@
#!/bin/sh
. /tmp/functions
# This runs whenever this genesis profile boots for customization
# purposes
# run_remote and run_remote_python are available to download scripts and
# execute them.