I'd like to automate the provisioning of a rke2 si...
# rke2
d
I'd like to automate the provisioning of a rke2 single-node cluster in the context of a SLE micro unattended install. Trying to run the rke2 install script from within the combustion script isn't working. Any suggestion?
It doesn't give an error, but it doesn't work either. Here are the combustion logs:
Copy code
May 06 18:34:37 myserver combustion[1503]: [INFO]  finding release for channel stable
May 06 18:34:38 myserver combustion[1503]: [INFO]  using v1.31.8+rke2r1 as release
May 06 18:34:38 myserver combustion[1503]: [INFO]  downloading checksums at <https://github.com/rancher/rke2/releases/download/v1.31.8%2Brke2r1/sha256sum-amd64.txt>
May 06 18:34:39 myserver combustion[1503]: [INFO]  downloading tarball at <https://github.com/rancher/rke2/releases/download/v1.31.8%2Brke2r1/rke2.linux-amd64.tar.gz>
May 06 18:34:42 myserver combustion[1503]: [INFO]  verifying tarball
May 06 18:34:42 myserver combustion[1503]: [INFO]  unpacking tarball file to /usr/local
May 06 18:34:43 myserver combustion[1503]: Running in chroot, ignoring command 'daemon-reload'
the time between the "Downloading tarball" and "verifying tarball" is almost instantaneous, so I very much doubt it's downloading anything serious, although the network is configured and working.
that's all there is to it. My combustion script follows:
Copy code
#!/bin/bash
# combustion: network prepare

set -euxo pipefail

umask 077 # Required for NM config
mkdir -p /etc/NetworkManager/system-connections/
cat >/etc/NetworkManager/system-connections/static.nmconnection <<-EOF

[connection]
id=static
type=ethernet
interface-name=eth0
autoconnect=true

[ipv4]
method=manual
dns=1.1.1.1
address1=192.168.7.21/24,192.168.7.254
ignore_auto_dns=true

[ipv6]
dns-search=
addr-gen-mode=eui64
method=ignore
EOF


if [ "${1-}" = "--prepare" ]; then
  exit 0
fi

# Redirect output to the console
exec > >(exec tee -a /dev/tty0) 2>&1

systemctl enable sshd.service

curl -sfL <https://get.rke2.io> | sh -


# Leave a marker
echo "Configured with combustion" > /etc/issue.d/combustion

# Close outputs and wait for tee to finish.
exec 1>&- 2>&-; wait;
if this cannot be done with combustion, I'd like some method to run a script upon first boot, although I see that cloud-init doesn't seem to be supported either...
b
SLE-Micro 6.1 has cloud-init
c
the time between the “Downloading tarball” and “verifying tarball” is almost instantaneous, so I very much doubt it’s downloading anything serious
The tarball is only like 36mb, how long do you expect it to take to sha256sum a few megabytes?
I suspect that the real problem is that you’re doing all this within the Combustion chroot, not on the actual OS filesystem itself. I am not sure if the chroot has /usr/local mounted or not.
d
@bumpy-tomato-36167 how do you enable/use cloud-init in sle-micro 6.1? that's actually the version I'm using, I wasn't able to find any documentation
c
same as you would on any other distro. cloud-init paths and kernel args are not distro-specific
note that you need to be using the public cloud images, those are the only ones that have cloud-init, as far as I know. Maybe that’s changed with 6.1
d
ah but this is a bare metal install
(sorry for not specifying it)
c
ah yeah I don’t think that will work. You could try passing the cloud-init-url on the kernel command line to see though: https://en.opensuse.org/Portal:MicroOS/cloud-init#Remote_Network_Source
or just use the #cloud-config header in your userdata file, however you’re passing that to your bare metal install currently
d
I'm not using any userdata file now...is that possible at all?
ah, I see what you mean
so perhaps I can install cloud-init with zypper in combustion, then have cloud-init run on first boot...I can try
autoyast is also out of question, right?
so perhaps I can install cloud-init with zypper in combustion, then have cloud-init run on first boot...I can try
so this works reasonably well, still refining some details but it roughly works
w
I had the same issue with K3s - since you can't install within the chroot I create a oneshot k3s-install systemd service which downloads and installs K3s once system has booted
d
ah that's also a good idea
thanks for sharing, but by now I'm 99% done with the cloud-init method
😀