k3os ok
This commit is contained in:
27
main.tf
27
main.tf
@@ -88,23 +88,24 @@ resource "hcloud_firewall" "k3s" {
|
||||
}
|
||||
}
|
||||
|
||||
data "hcloud_image" "linux" {
|
||||
name = "ubuntu-20.04"
|
||||
}
|
||||
|
||||
locals {
|
||||
first_control_plane_network_ip = cidrhost(hcloud_network.k3s.ip_range, 2)
|
||||
name_master = "k3s-control-plane-0"
|
||||
ssh_public_key = trimspace(file(var.public_key))
|
||||
hcloud_image_name = "ubuntu-20.04"
|
||||
|
||||
k3os_install_commands = [
|
||||
"apt install -y grub-efi grub-pc-bin mtools xorriso",
|
||||
"latest=$(curl -s https://api.github.com/repos/rancher/k3os/releases | jq '.[0].tag_name')",
|
||||
"curl -Lo ./install.sh https://raw.githubusercontent.com/rancher/k3os/$(echo $latest | xargs)/install.sh",
|
||||
"chmod +x ./install.sh",
|
||||
"./install.sh --config /tmp/config.yaml /dev/sda https://github.com/rancher/k3os/releases/download/$(echo $latest | xargs)/k3os-amd64.iso",
|
||||
"shutdown -r +1",
|
||||
"sleep 3",
|
||||
"exit 0"
|
||||
]
|
||||
}
|
||||
|
||||
data "template_file" "master" {
|
||||
template = file("${path.module}/templates/master.tpl")
|
||||
|
||||
vars = {
|
||||
name = local.name_master
|
||||
ssh_public_key = local.ssh_public_key
|
||||
k3s_token = random_password.k3s_token.result
|
||||
ip = local.first_control_plane_network_ip
|
||||
}
|
||||
data "hcloud_image" "linux" {
|
||||
name = local.hcloud_image_name
|
||||
}
|
||||
|
Reference in New Issue
Block a user