microOS eth1 still down

This commit is contained in:
Karim Naufal 2022-02-05 01:22:35 +01:00
parent 3f0f0ca705
commit 623954e5ef
6 changed files with 34 additions and 4 deletions

View File

@ -13,8 +13,9 @@ locals {
microOS_install_commands = [
"set -ex",
"aria2c https://download.opensuse.org/tumbleweed/appliances/openSUSE-MicroOS.x86_64-kvm-and-xen.qcow2.meta4",
"qemu-img convert -p -f qcow2 -O host_device $(ls -a | grep MicroOS | grep -v meta4) /dev/sda",
"apt install -y aria2",
"aria2c --follow-metalink=mem https://download.opensuse.org/tumbleweed/appliances/openSUSE-MicroOS.x86_64-k3s-kvm-and-xen.qcow2.meta4",
"qemu-img convert -p -f qcow2 -O host_device $(ls -a | grep -ie '^opensuse.*microos.*k3s.*qcow2$') /dev/sda",
"sgdisk -e /dev/sda",
"partprobe /dev/sda",
"parted -s /dev/sda resizepart 4 99%",

View File

@ -31,6 +31,20 @@ resource "hcloud_server" "first_control_plane" {
}
}
provisioner "file" {
content = templatefile("${path.module}/templates/config.ign.tpl", {
ssh_public_key = local.ssh_public_key
})
destination = "/root/config.ign"
connection {
user = "root"
private_key = local.ssh_private_key
agent_identity = local.ssh_identity
host = self.ipv4_address
}
}
# Install k3os
provisioner "remote-exec" {
inline = local.microOS_install_commands
@ -42,7 +56,7 @@ resource "hcloud_server" "first_control_plane" {
host = self.ipv4_address
}
}
/*
# Wait for MicroOS to be ready and fetch kubeconfig.yaml
provisioner "local-exec" {
command = <<-EOT
@ -65,7 +79,7 @@ resource "hcloud_server" "first_control_plane" {
provisioner "local-exec" {
command = "kubectl apply -f ${local_file.traefik_config.filename} --kubeconfig ${path.module}/kubeconfig.yaml"
}
*/
network {
network_id = hcloud_network.k3s.id
ip = local.first_control_plane_network_ip

15
templates/config.ign.tpl Normal file
View File

@ -0,0 +1,15 @@
{
"ignition": {
"version": "3.0.0"
},
"passwd": {
"users": [
{
"name": "root",
"sshAuthorizedKeys": [
"${ssh_public_key}"
]
}
]
}
}