mirror of
https://github.com/optim-enterprises-bv/terraform-talos.git
synced 2025-11-02 19:28:35 +00:00
Upload talos to DO
This commit is contained in:
53
system_os/digitalocean/do.pkr.hcl
Normal file
53
system_os/digitalocean/do.pkr.hcl
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
|
||||||
|
packer {
|
||||||
|
required_plugins {
|
||||||
|
digitalocean = {
|
||||||
|
version = ">= 1.0.0"
|
||||||
|
source = "github.com/hashicorp/digitalocean"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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"
|
||||||
|
region = var.do_region
|
||||||
|
size = "s-1vcpu-1gb"
|
||||||
|
monitoring = false
|
||||||
|
|
||||||
|
ipv6 = true
|
||||||
|
private_networking = false
|
||||||
|
|
||||||
|
ssh_username = "root"
|
||||||
|
|
||||||
|
snapshot_name = "talos system disk"
|
||||||
|
snapshot_regions = [var.do_region]
|
||||||
|
}
|
||||||
|
|
||||||
|
# FIXME
|
||||||
|
build {
|
||||||
|
sources = ["source.digitalocean.talos"]
|
||||||
|
provisioner "shell" {
|
||||||
|
inline = [
|
||||||
|
"apt-get install -y wget",
|
||||||
|
"wget -O /tmp/digital-ocean.tar.gz https://github.com/talos-systems/talos/releases/download/${var.talos_version}/digital-ocean-amd64.tar.gz",
|
||||||
|
"cd /tmp && tar xzf /tmp/digital-ocean.tar.gz && dd if=/tmp/disk.raw of=/dev/vda",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -45,13 +45,14 @@ source "upcloud" "talos" {
|
|||||||
# clone_zones = var.upcloud_zones
|
# clone_zones = var.upcloud_zones
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# FIXME
|
||||||
build {
|
build {
|
||||||
sources = ["source.upcloud.talos"]
|
sources = ["source.upcloud.talos"]
|
||||||
provisioner "shell" {
|
provisioner "shell" {
|
||||||
inline = [
|
inline = [
|
||||||
"apt-get install -y wget",
|
"apt-get install -y wget",
|
||||||
"wget -O /tmp/talos.tar.gz https://github.com/talos-systems/talos/releases/download/${var.talos_version}/metal-amd64.tar.gz",
|
"wget -O /tmp/talos.tar.gz https://github.com/talos-systems/talos/releases/download/${var.talos_version}/metal-amd64.tar.gz",
|
||||||
"tar xOzf /tmp/talos.tar.gz | dd of=/dev/vda",
|
"sync && sync && tar xOzf /tmp/talos.tar.gz | dd of=/dev/vda && systemctl --force --force poweroff",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user