From a8a1dc583df644f0ece106d50b7bf89a153ae203 Mon Sep 17 00:00:00 2001 From: Serge Logvinov Date: Fri, 20 Aug 2021 23:44:13 +0300 Subject: [PATCH] Split blocks --- system_os/digitalocean/do.pkr.hcl | 16 ------------- system_os/digitalocean/variables.pkr.hcl | 16 +++++++++++++ system_os/hetzner/Makefile | 6 +++++ system_os/hetzner/hetzner.pkr.hcl | 30 ++++++++++++++---------- system_os/hetzner/variables.pkr.hcl | 15 ++++++++++++ 5 files changed, 55 insertions(+), 28 deletions(-) create mode 100644 system_os/digitalocean/variables.pkr.hcl create mode 100644 system_os/hetzner/Makefile create mode 100644 system_os/hetzner/variables.pkr.hcl diff --git a/system_os/digitalocean/do.pkr.hcl b/system_os/digitalocean/do.pkr.hcl index fd6f1f8..df987d2 100644 --- a/system_os/digitalocean/do.pkr.hcl +++ b/system_os/digitalocean/do.pkr.hcl @@ -8,22 +8,6 @@ packer { } } -variable "do_api_token" { - type = string - default = "${env("DO_API_TOKEN")}" - sensitive = true -} - -variable "do_region" { - type = string - default = "lon1" -} - -variable "talos_version" { - type = string - default = "v0.11.0" -} - source "digitalocean" "talos" { api_token = var.do_api_token image = "debian-10-x64" diff --git a/system_os/digitalocean/variables.pkr.hcl b/system_os/digitalocean/variables.pkr.hcl new file mode 100644 index 0000000..fdaa0a9 --- /dev/null +++ b/system_os/digitalocean/variables.pkr.hcl @@ -0,0 +1,16 @@ + +variable "do_api_token" { + type = string + default = "${env("DO_API_TOKEN")}" + sensitive = true +} + +variable "do_region" { + type = string + default = "lon1" +} + +variable "talos_version" { + type = string + default = "v0.11.0" +} diff --git a/system_os/hetzner/Makefile b/system_os/hetzner/Makefile new file mode 100644 index 0000000..25b3ca3 --- /dev/null +++ b/system_os/hetzner/Makefile @@ -0,0 +1,6 @@ + +release: + packer build -only=release.hcloud.talos . + +develop: + packer build -only=develop.hcloud.talos . diff --git a/system_os/hetzner/hetzner.pkr.hcl b/system_os/hetzner/hetzner.pkr.hcl index bae0966..563268c 100644 --- a/system_os/hetzner/hetzner.pkr.hcl +++ b/system_os/hetzner/hetzner.pkr.hcl @@ -8,17 +8,6 @@ packer { } } -variable "hcloud_token" { - type = string - default = env("HCLOUD_TOKEN") - sensitive = true -} - -variable "talos_version" { - type = string - default = "v0.11.4" -} - source "hcloud" "talos" { token = var.hcloud_token rescue = "linux64" @@ -36,11 +25,28 @@ source "hcloud" "talos" { } build { + name = "release" sources = ["source.hcloud.talos"] + provisioner "shell" { inline = [ "apt-get install -y wget", - "wget -O /tmp/openstack.tar.gz https://github.com/talos-systems/talos/releases/download/${var.talos_version}/openstack-amd64.tar.gz", + "wget -O /tmp/openstack.tar.gz ${local.image}", + "tar xOzf /tmp/talos.tar.gz | dd of=/dev/sda && sync", + ] + } +} + +build { + name = "develop" + sources = ["source.hcloud.talos"] + + provisioner "file" { + source = "../../../talos-pr/_out/hcloud-amd64.tar.gz" + destination = "/tmp/talos.tar.gz" + } + provisioner "shell" { + inline = [ "tar xOzf /tmp/talos.tar.gz | dd of=/dev/sda && sync", ] } diff --git a/system_os/hetzner/variables.pkr.hcl b/system_os/hetzner/variables.pkr.hcl new file mode 100644 index 0000000..5b53571 --- /dev/null +++ b/system_os/hetzner/variables.pkr.hcl @@ -0,0 +1,15 @@ + +variable "hcloud_token" { + type = string + default = env("HCLOUD_TOKEN") + sensitive = true +} + +variable "talos_version" { + type = string + default = "v0.12.0" +} + +locals { + image = "https://github.com/talos-systems/talos/releases/download/${var.talos_version}/openstack-amd64.tar.gz" +}