mirror of
https://github.com/xcat2/confluent.git
synced 2026-06-15 08:10:44 +00:00
Iterate SUSE16 deployment support
This commit is contained in:
Executable
@@ -36,6 +36,24 @@
|
||||
"language": "%%LOCALE%%",
|
||||
"keyboard": "%%KEYMAP%%",
|
||||
"timezone": "%%TIMEZONE%%"
|
||||
},
|
||||
"scripts": {
|
||||
"post": [
|
||||
{
|
||||
"name": "confluent-prechroot.sh",
|
||||
"url": "https://%%DEPLOYER%%/confluent-public/os/%%PROFILE%%/scripts/prechroot.sh",
|
||||
"chroot": false
|
||||
},
|
||||
{
|
||||
"name": "confluent-post.sh",
|
||||
"url": "https://%%DEPLOYER%%/confluent-public/os/%%PROFILE%%/scripts/post.sh",
|
||||
"chroot": true
|
||||
}
|
||||
],
|
||||
"init": {
|
||||
"name": "confluent-init.sh",
|
||||
"url": "https://%%DEPLOYER%%/confluent-public/os/%%PROFILE%%/scripts/firstboot.sh"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,38 +2,28 @@
|
||||
serialcons=$(tty)
|
||||
if [ -e /run/confluent/01-autocons.conf ]; then
|
||||
serialcons=$(cat /run/confluent/01-autocons.conf|sed -e s/.*=// -e s/,.*//)
|
||||
fi
|
||||
echo "Initializing SSH" > $serialcons
|
||||
for pubkey in /etc/ssh/ssh_host_*.pub; do
|
||||
privfile=${pubkey%.pub}
|
||||
certfile=${pubkey/.pub/-cert.pub}
|
||||
python3 /opt/confluent/bin/apiclient /confluent-api/self/sshcert $pubkey > $certfile 2> $serialcons
|
||||
if [ -s $certfile ]; then
|
||||
echo HostCertificate $certfile >> /etc/ssh/sshd_config.d/20_hostkeys.conf
|
||||
if [ -n "$serialcons" ]; then
|
||||
serialcons=/dev/$serialcons
|
||||
else
|
||||
serialcons=$(tty)
|
||||
fi
|
||||
done
|
||||
systemctl restart sshd > $serialcons 2>&1
|
||||
profile=$(grep ^profile: /etc/confluent/confluent.deploycfg|awk '{print $2}')
|
||||
python3 /opt/confluent/bin/apiclient /confluent-public/os/$profile/autoinstall.json > /tmp/autoinstall.json 2> $serialcons
|
||||
sed -i s/%%ROOTPASSWORD%%/$(grep ^rootpassword: /etc/confluent/confluent.deploycfg|awk '{print $2}')/g /tmp/autoinstall.json
|
||||
sed -i s/%%NODENAME%%/$(hostname)/g /tmp/autoinstall.json
|
||||
python3 /opt/confluent/bin/apiclient /confluent-public/os/$profile/scripts/getinstalldisk > /tmp/getinstalldisk 2> $serialcons
|
||||
python3 /tmp/getinstalldisk > $serialcons 2>&1
|
||||
installdisk=$(cat /tmp/getinstalldisk)
|
||||
if [ -z "$installdisk" ]; then
|
||||
echo "Unable to determine target disk for installation" > $serialcons
|
||||
sleep inf
|
||||
fi
|
||||
echo "Installing to $installdisk" > $serialcons
|
||||
sed -i 's!%%INSTALLDISK%%!'$installdisk'!g' /tmp/autoinstall.json
|
||||
locale=$(grep ^locale: /etc/confluent/confluent.deploycfg)
|
||||
locale=${locale#locale: }
|
||||
keymap=$(grep ^keymap: /etc/confluent/confluent.deploycfg)
|
||||
keymap=${keymap#keymap: }
|
||||
tz=$(grep ^timezone: /etc/confluent/confluent.deploycfg)
|
||||
tz=${tz#timezone: }
|
||||
sed -i 's!%%TIMEZONE%%/'$tz'!g' /tmp/autoinstall.json
|
||||
sed -i s/%%LOCALE%%/$locale/g /tmp/autoinstall.json
|
||||
sed -i s/%%KEYMAP%%/$keymap/g /tmp/autoinstall.json
|
||||
profile=$(grep ^profile: /etc/confluent/confluent.deploycfg|awk '{print $2}')
|
||||
export profile
|
||||
python3 /opt/confluent/bin/apiclient /confluent-public/os/$profile/scripts/functions > /etc/confluent/functions
|
||||
. /etc/confluent/functions
|
||||
touch /tmp/confluent-pre.log
|
||||
tail -f /tmp/confluent-pre.log > $serialcons 2>&1 &
|
||||
tailpid=$!
|
||||
python3 /opt/confluent/bin/apiclient /confluent-public/os/$profile/scripts/pre.sh > /tmp/pre.sh 2> $serialcons
|
||||
chmod +x /tmp/pre.sh
|
||||
/tmp/pre.sh > $serialcons 2>&1
|
||||
kill $tailpid
|
||||
agama config load /tmp/autoinstall.json > $serialcons 2>&1
|
||||
|
||||
agama install > $serialcons 2>&1
|
||||
python3 /opt/confluent/bin/apiclient /confluent-public/os/$profile/scripts/post.sh > /tmp/post.sh 2> $serialcons
|
||||
chmod +x /tmp/post.sh
|
||||
touch /tmp/confluent-post.log
|
||||
tail -f /tmp/confluent-post.log > $serialcons 2>&1 &
|
||||
/tmp/post.sh > $serialcons 2>&1
|
||||
agama finish > $serialcons 2>&1
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
#!/bin/bash
|
||||
|
||||
# This script runs at the end of install in the installed system
|
||||
# but still under the installer kernel.
|
||||
|
||||
# This is a good place to run most customizations that do not have any
|
||||
# dependency upon the install target kernel being active.
|
||||
|
||||
# If there are dependencies on the kernel (drivers or special filesystems)
|
||||
# then firstboot.sh would be the script to customize.
|
||||
|
||||
chmod 700 /var/log/confluent
|
||||
exec >> /var/log/confluent/confluent-post.log
|
||||
exec 2>> /var/log/confluent/confluent-post.log
|
||||
chmod 600 /var/log/confluent/confluent-post.log
|
||||
confluent_mgr=$(grep ^deploy_server /etc/confluent/confluent.deploycfg|awk '{print $2}')
|
||||
confluent_profile=$(grep ^profile: /etc/confluent/confluent.deploycfg|sed -e 's/^profile: //')
|
||||
nodename=$(grep ^NODENAME /etc/confluent/confluent.info|awk '{print $2}')
|
||||
confluent_apikey=$(cat /etc/confluent/confluent.apikey)
|
||||
|
||||
chmod 700 /etc/confluent
|
||||
chmod og-rwx /etc/confluent/*
|
||||
|
||||
|
||||
export confluent_mgr confluent_profile nodename
|
||||
. /etc/confluent/functions
|
||||
|
||||
# This will induce server side processing of the syncfile contents if
|
||||
# present
|
||||
run_remote_python syncfileclient
|
||||
|
||||
run_remote post.custom
|
||||
|
||||
# Also, scripts may be placed into 'post.d', e.g. post.d/01-runfirst.sh, post.d/02-runsecond.sh
|
||||
run_remote_parts post.d
|
||||
|
||||
# Induce execution of remote configuration, e.g. ansible plays in ansible/post.d/
|
||||
run_remote_config post.d
|
||||
|
||||
curl -X POST -d 'status: staged' -H "CONFLUENT_NODENAME: $nodename" -H "CONFLUENT_APIKEY: $confluent_apikey" https://$confluent_mgr/confluent-api/self/updatestatus
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
#!/bin/bash
|
||||
|
||||
# This script runs before the installer executes, and sets up ssh during install as well
|
||||
# as rewriting the autoyast file with any substitutions prior to it being evaluated for real
|
||||
|
||||
exec >> /tmp/confluent-pre.log
|
||||
exec 2>> /tmp/confluent-pre.log
|
||||
chmod 600 /tmp/confluent-pre.log
|
||||
cryptboot=$(grep encryptboot: /etc/confluent/confluent.deploycfg|sed -e 's/^encryptboot: //')
|
||||
if [ "$cryptboot" != "" ] && [ "$cryptboot" != "none" ] && [ "$cryptboot" != "null" ]; then
|
||||
echo "****Encrypted boot requested, but not implemented for this OS, halting install"
|
||||
while :; do sleep 86400; done
|
||||
fi
|
||||
echo "Initializing SSH"
|
||||
for pubkey in /etc/ssh/ssh_host_*key.pub; do
|
||||
privfile=${pubkey%.pub}
|
||||
certfile=${pubkey/.pub/-cert.pub}
|
||||
python3 /opt/confluent/bin/apiclient /confluent-api/self/sshcert $pubkey > $certfile
|
||||
if [ -s $certfile ]; then
|
||||
echo HostCertificate $certfile >> /etc/ssh/sshd_config.d/20_hostkeys.conf
|
||||
fi
|
||||
done
|
||||
systemctl restart sshd
|
||||
python3 /opt/confluent/bin/apiclient /confluent-public/os/$profile/autoinstall.json > /tmp/autoinstall.json
|
||||
deployserver=$(grep ^deploy_server /etc/confluent/confluent.deploycfg|awk '{print $2}')
|
||||
if [ -z "$deployserver" ] || [ "$deployserver" = "none" ] || [ "$deployserver" = "null" ]; then
|
||||
deployserver=$(grep ^deploy_server_v6 /etc/confluent/confluent.deploycfg|awk '{print $2}')
|
||||
fi
|
||||
if [[ "$deployserver" == *":"* ]]; then
|
||||
deployserver="[$deployserver]"
|
||||
fi
|
||||
|
||||
run_remote_parts pre.d
|
||||
sed -i s!%%DEPLOYSERVER%%!$deployserver!g /tmp/autoinstall.json
|
||||
sed -i s!%%PROFILE%%!$(grep ^profile: /etc/confluent/confluent.deploycfg|awk '{print $2}')!g /tmp/autoinstall.json
|
||||
sed -i s!%%ROOTPASSWORD%%!$(grep ^rootpassword: /etc/confluent/confluent.deploycfg|awk '{print $2}')!g /tmp/autoinstall.json
|
||||
sed -i s!%%NODENAME%%!$(hostname)!g /tmp/autoinstall.json
|
||||
python3 /opt/confluent/bin/apiclient /confluent-public/os/$profile/scripts/getinstalldisk > /tmp/getinstalldisk
|
||||
locale=$(grep ^locale: /etc/confluent/confluent.deploycfg)
|
||||
locale=${locale#locale: }
|
||||
keymap=$(grep ^keymap: /etc/confluent/confluent.deploycfg)
|
||||
keymap=${keymap#keymap: }
|
||||
tz=$(grep ^timezone: /etc/confluent/confluent.deploycfg)
|
||||
tz=${tz#timezone: }
|
||||
sed -i 's!%%TIMEZONE%%!'$tz'!g' /tmp/autoinstall.json
|
||||
sed -i 's!%%LOCALE%%!'$locale'!g' /tmp/autoinstall.json
|
||||
sed -i 's!%%KEYMAP%%!'$keymap'!g' /tmp/autoinstall.json
|
||||
if [ ! -e /tmp/installdisk ]; then
|
||||
python3 /tmp/getinstalldisk > $serialcons 2>&1
|
||||
fi
|
||||
installdisk=$(cat /tmp/installdisk)
|
||||
if [ -z "$installdisk" ]; then
|
||||
echo "Unable to determine target disk for installation"
|
||||
sleep inf
|
||||
fi
|
||||
echo "Installing to $installdisk"
|
||||
sed -i 's!%%INSTALLDISK%%!'/dev/$installdisk'!g' /tmp/autoinstall.json
|
||||
Reference in New Issue
Block a user