moved k3s-selinux install to combustion

This commit is contained in:
Karim Naufal
2022-02-17 13:19:21 +01:00
parent f59225bf9c
commit 1f0a03b335
6 changed files with 38 additions and 47 deletions

View File

@@ -30,6 +30,12 @@ resource "hcloud_server" "control_planes" {
destination = "/root/config.ign"
}
# Combustion script file to install k3s-selinux
provisioner "file" {
content = local.combustion_script
destination = "/root/script"
}
# Install MicroOS
provisioner "remote-exec" {
inline = local.microOS_install_commands
@@ -74,23 +80,10 @@ resource "hcloud_server" "control_planes" {
inline = local.install_k3s_server
}
# Issue a reboot command and wait for the node to reboot
provisioner "local-exec" {
command = "ssh ${local.ssh_args} root@${self.ipv4_address} '(sleep 2; reboot)&'; sleep 3"
}
provisioner "local-exec" {
command = <<-EOT
until ssh ${local.ssh_args} -o ConnectTimeout=2 root@${self.ipv4_address} true 2> /dev/null
do
echo "Waiting for MicroOS to reboot and become available..."
sleep 2
done
EOT
}
# Upon reboot verify that the k3s server starts correctly
provisioner "remote-exec" {
inline = [
"systemctl start k3s",
<<-EOT
timeout 120 bash <<EOF
until systemctl status k3s > /dev/null; do