2
0
mirror of https://github.com/xcat2/confluent.git synced 2025-03-28 19:16:58 +00:00

Further the ubuntu prototype

Switch to using firstboot mechanism as cloud-init
fights us too hard on ssh keys and root password.
This commit is contained in:
Jarrod Johnson 2020-05-01 16:41:01 -04:00
parent 2ac139934e
commit f3747025ff
4 changed files with 22 additions and 3 deletions

View File

@ -0,0 +1,9 @@
#!/bin/bash
echo "Confluent first boot is running"
cp -a /etc/confluent/ssh/* /etc/ssh/
systemctl restart sshd
rootpw=$(grep ^rootpassword: /etc/confluent/confluent.deploycfg |awk '{print $2}')
if [ ! -z "$rootpw" -a "$rootpw" != "null" ]; then
echo root:$rootpw | chpasswd -e
fi
hostnamectl set-hostname $(grep ^NODENAME: /etc/confluent/confluent.info | awk '{print $2}')

View File

@ -4,10 +4,13 @@ mkdir -p /root/custom-installation/ssh
cp /ssh/* /root/custom-installation/ssh
NODENAME=$(grep ^NODENAME: /custom-installation/confluent/confluent.info|awk '{print $2}')
MGR=$(grep ^MANAGER: /custom-installation/confluent/confluent.info|head -n 1| awk '{print $2}')
oum=$(umask)
umask 077
chroot . custom-installation/confluent/bin/clortho $NODENAME $MGR > /root/custom-installation/confluent/confluent.apikey
MGR=[$MGR]
deploycfg=/root/custom-installation/confluent/confluent.deploycfg
chroot . usr/bin/curl -f -H "CONFLUENT_NODENAME: $NODENAME" -H "CONFLUENT_APIKEY: $(cat /root//custom-installation/confluent/confluent.apikey)" https://${MGR}/confluent-api/self/deploycfg > $deploycfg
umask $oum
nic=$(grep ^MANAGER /custom-installation/confluent/confluent.info|grep fe80::|sed -e s/.*%//|head -n 1)
nic=$(ip link |grep ^$nic:|awk '{print $2}')
DEVICE=${nic%:}
@ -35,7 +38,7 @@ else
fi
ipv4s=$(grep ^ipv4_server $deploycfg|awk '{print $2}')
osprofile=$(cat /custom-installation/confluent/osprofile)
fcmdline='ds=nocloud-net;s=https://'${ipv4s}'/confluent-public/os/'${osprofile}'/autoinstall/'
fcmdline='quiet autoinstall ds=nocloud-net;s=https://'${ipv4s}'/confluent-public/os/'${osprofile}'/autoinstall/'
cons=$(cat /custom-installation/autocons.info)
if [ ! -z "$cons" ]; then
echo "Installation will proceed on graphics console, autoconsole cannot work during install for Ubuntu" > ${cons%,*}

View File

@ -0,0 +1,6 @@
cp -a /root/.ssh /target/root/
mkdir -p /target/etc/confluent/ssh/sshd_config.d/
cp /custom-installation/confluent/* /target/etc/confluent/
cp -a /etc/ssh/ssh_host* /target/etc/confluent/ssh/
cp -a /etc/ssh/sshd_config.d/confluent.conf /target/etc/confluent/ssh/sshd_config.d/
cp /custom-installation/firstboot.sh /target/etc/confluent/firstboot.sh

View File

@ -10,7 +10,9 @@ while ! grep NODENAME /custom-installation/confluent/confluent.info; do
done
MGR="[$(grep MANAGER: /custom-installation/confluent/confluent.info | head -n 1 | awk '{print $2}')]"
osprofile=$(sed -e 's/.*osprofile=//' -e 's/ .*//' /proc/cmdline)
cons=$(cat /custom-installation/autocons.info)
if [ -f /custom-installation/autocons.info ]; then
cons=$(cat /custom-installation/autocons.info)
fi
if [ ! -z "$cons" ]; then
echo "Preparing to deploy $osprofile from $MGR" > ${cons%,*}
fi
@ -18,7 +20,6 @@ echo "Preparing to deploy $osprofile from $MGR"
echo $osprofile > /custom-installation/confluent/osprofile
echo URL=http://${MGR}/confluent-public/os/$osprofile/distribution/live.iso >> /conf/param.conf
fcmdline="url=http://${MGR}/confluent-public/os/$osprofile/distribution/live.iso"
cons=$(cat /custom-installation/autocons.info)
if [ ! -z "$cons" ]; then
fcmdline="$fcmdline console=${console#/dev/}"
elif grep console= /proc/cmdline; then