diff --git a/confluent_osdeploy/el8/profiles/default/kickstart b/confluent_osdeploy/el8/profiles/default/kickstart index 667608c0..f3332c67 100644 --- a/confluent_osdeploy/el8/profiles/default/kickstart +++ b/confluent_osdeploy/el8/profiles/default/kickstart @@ -22,7 +22,7 @@ curl -f https://$mgr/confluent-public/os/$profile/scripts/pre.sh > /tmp/preinst. mkdir -p /mnt/sysimage/etc/confluent profile=$(grep ^profile: /etc/confluent.deploycfg |awk '{print $2}') mgr=$(grep deploy_server /etc/confluent.deploycfg |awk '{print $2}') -curl -f https://$mgr/confluent-public/os/$profile/scripts/post.sh > /tmp/postinst.sh +curl -f https://$mgr/confluent-public/os/$profile/scripts/prechroot.sh > /tmp/postinst.sh . /tmp/postinst.sh # Hook firstboot.sh @@ -35,4 +35,8 @@ chmod +x /mnt/sysimage/etc/confluent/firstboot.sh systemctl enable firstboot chgrp ssh_keys /etc/ssh/ssh*key restorecon /etc/ssh/ssh*key /root/.shosts /etc/ssh/shosts.equiv /etc/ssh/ssh_config.d/* /etc/confluent/firstboot.sh +profile=$(grep ^profile: /etc/confluent/confluent.deploycfg |awk '{print $2}') +mgr=$(grep deploy_server /etc/confluent/confluent.deploycfg |awk '{print $2}') +curl -f https://$mgr/confluent-public/os/$profile/scripts/post.sh > /tmp/postinst.sh +. /tmp/postinst.sh %end diff --git a/confluent_osdeploy/el8/profiles/default/scripts/post.sh b/confluent_osdeploy/el8/profiles/default/scripts/post.sh deleted file mode 100644 index 06706f16..00000000 --- a/confluent_osdeploy/el8/profiles/default/scripts/post.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh -# need to copy over ssh key info -grep HostCert /etc/ssh/sshd_config.anaconda >> /mnt/sysimage/etc/ssh/sshd_config -echo HostbasedAuthentication yes >> /mnt/sysimage/etc/ssh/sshd_config -echo HostbasedUsesNameFromPacketOnly yes >> /mnt/sysimage/etc/ssh/sshd_config -echo IgnoreRhosts no >> /mnt/sysimage/etc/ssh/sshd_config -sshconf=/etc/ssh/ssh_config -if [ -d /mnt/sysimage/etc/ssh/ssh_config.d/ ]; then - sshconf=/mnt/sysimage/etc/ssh/ssh_config.d/01-confluent.conf -fi -echo 'Host *' >> $sshconf -echo ' HostbasedAuthentication yes' >> $sshconf -echo ' EnableSSHKeysign yes' >> $sshconf -echo ' HostbasedKeyTypes *ed25519*' >> $sshconf - -cp /etc/ssh/ssh_host_* /mnt/sysimage/etc/ssh/ -mkdir /mnt/sysimage/root/.ssh/ -chmod 700 /mnt/sysimage/root/.ssh/ -cp /root/.ssh/authorized_keys /mnt/sysimage/root/.ssh/ -chmod 600 /mnt/sysimage/root/.ssh/authorized_keys -cp /etc/ssh/ssh_known_hosts /mnt/sysimage/etc/ssh/ -cp -a /etc/confluent /mnt/sysimage/etc -nodename=$(grep ^NODENAME /etc/confluent.info|awk '{print $2}') -curl -f -H "CONFLUENT_NODENAME: $nodename" -H "CONFLUENT_APIKEY: $(cat /etc/confluent.apikey)" https://$mgr/confluent-api/self/nodelist > /tmp/allnodes -cp /tmp/allnodes /mnt/sysimage/etc/ssh/shosts.equiv -cp /tmp/allnodes /mnt/sysimage/root/.shosts diff --git a/confluent_osdeploy/el8/profiles/default/scripts/pre.sh b/confluent_osdeploy/el8/profiles/default/scripts/pre.sh index 50dcd35f..d78eb977 100644 --- a/confluent_osdeploy/el8/profiles/default/scripts/pre.sh +++ b/confluent_osdeploy/el8/profiles/default/scripts/pre.sh @@ -25,8 +25,10 @@ if [ -f "/run/install/cmdline.d/01-autocons.conf" ]; then consoledev=$(cat /run/install/cmdline.d/01-autocons.conf | sed -e 's!console=!/dev/!' -e 's/,.*//') tmux a <> $consoledev >&0 2>&1 & fi -curl -f https://$mgr/confluent-public/os/$profile/scripts/getinstalldisk > /tmp/getinstalldisk -/usr/libexec/platform-python /tmp/getinstalldisk +export mgr profile nodename +curl -f https://$mgr/confluent-public/os/$profile/scripts/functions > /tmp/functions +. /tmp/functions +run_remote_python getinstalldisk if [ -e /tmp/installdisk ]; then echo clearpart --all --initlabel >> /tmp/partitioning echo ignoredisk --only-use $(cat /tmp/installdisk) >> /tmp/partitioning diff --git a/confluent_osdeploy/el8/profiles/default/scripts/prechroot.sh b/confluent_osdeploy/el8/profiles/default/scripts/prechroot.sh new file mode 100644 index 00000000..3b500931 --- /dev/null +++ b/confluent_osdeploy/el8/profiles/default/scripts/prechroot.sh @@ -0,0 +1,8 @@ +#!/bin/sh +# need to copy over ssh key info +nodename=$(grep ^NODENAME /etc/confluent.info|awk '{print $2}') +export mgr profile nodename +cp -a /etc/confluent /mnt/sysimage/etc +curl -f https://$mgr/confluent-public/os/$profile/scripts/functions > /tmp/functions +. /tmp/functions +run_remote setupssh.sh