Add atomic_assets_endpoint var for fedora-atomic bare-metal

This commit is contained in:
Dalton Hubble 2018-04-20 17:44:24 -07:00
parent 9b88d4bbfd
commit 3f2978821b
3 changed files with 20 additions and 6 deletions

View File

@ -17,7 +17,7 @@ network --bootproto=dhcp --device=link --activate --onboot=on
bootloader --timeout=1 --append="ds=nocloud\;seedfrom=/var/cloud-init/" bootloader --timeout=1 --append="ds=nocloud\;seedfrom=/var/cloud-init/"
services --enabled=cloud-init,cloud-init-local,cloud-config,cloud-final services --enabled=cloud-init,cloud-init-local,cloud-config,cloud-final
ostreesetup --osname="fedora-atomic" --remote="fedora-atomic-27" --url="${matchbox_http_endpoint}/assets/fedora/27/repo" --ref=fedora/27/x86_64/atomic-host --nogpg ostreesetup --osname="fedora-atomic" --remote="fedora-atomic-27" --url="${atomic_assets_endpoint}/repo" --ref=fedora/27/x86_64/atomic-host --nogpg
reboot reboot

View File

@ -1,3 +1,8 @@
locals {
default_assets_endpoint = "${var.matchbox_http_endpoint}/assets/fedora/27"
atomic_assets_endpoint = "${var.atomic_assets_endpoint != "" ? var.atomic_assets_endpoint : local.default_assets_endpoint}"
}
// Cached Fedora Install profile (from matchbox /assets cache) // Cached Fedora Install profile (from matchbox /assets cache)
// Note: Admin must have downloaded Fedora kernel, initrd, and repo into // Note: Admin must have downloaded Fedora kernel, initrd, and repo into
// matchbox assets. // matchbox assets.
@ -5,15 +10,15 @@ resource "matchbox_profile" "cached-fedora-install" {
count = "${length(var.controller_names) + length(var.worker_names)}" count = "${length(var.controller_names) + length(var.worker_names)}"
name = "${format("%s-cached-fedora-install-%s", var.cluster_name, element(concat(var.controller_names, var.worker_names), count.index))}" name = "${format("%s-cached-fedora-install-%s", var.cluster_name, element(concat(var.controller_names, var.worker_names), count.index))}"
kernel = "/assets/fedora/27/vmlinuz" kernel = "${local.atomic_assets_endpoint}/images/pxeboot/vmlinuz"
initrd = [ initrd = [
"/assets/fedora/27/initrd.img", "${local.atomic_assets_endpoint}/images/pxeboot/initrd.img",
] ]
args = [ args = [
"initrd=initrd.img", "initrd=initrd.img",
"inst.repo=${var.matchbox_http_endpoint}/assets/fedora/27/Server/x86_64/os/", "inst.repo=${local.atomic_assets_endpoint}",
"inst.ks=${var.matchbox_http_endpoint}/generic?mac=${element(concat(var.controller_macs, var.worker_macs), count.index)}", "inst.ks=${var.matchbox_http_endpoint}/generic?mac=${element(concat(var.controller_macs, var.worker_macs), count.index)}",
"inst.text", "inst.text",
"${var.kernel_args}", "${var.kernel_args}",
@ -30,6 +35,7 @@ data "template_file" "install-kickstarts" {
vars { vars {
matchbox_http_endpoint = "${var.matchbox_http_endpoint}" matchbox_http_endpoint = "${var.matchbox_http_endpoint}"
atomic_assets_endpoint = "${local.atomic_assets_endpoint}"
mac = "${element(concat(var.controller_macs, var.worker_macs), count.index)}" mac = "${element(concat(var.controller_macs, var.worker_macs), count.index)}"
} }
} }

View File

@ -10,6 +10,16 @@ variable "matchbox_http_endpoint" {
description = "Matchbox HTTP read-only endpoint (e.g. http://matchbox.example.com:8080)" description = "Matchbox HTTP read-only endpoint (e.g. http://matchbox.example.com:8080)"
} }
variable "atomic_assets_endpoint" {
type = "string"
default = ""
description = <<EOD
HTTP endpoint serving the Fedora Atomic Host vmlinuz, initrd, os repo, and ostree repo (.e.g `http://example.com/some/path`).
Ensure the HTTP server directory contains `vmlinuz` and `initrd` files and `os` and `repo` directories. Leave unset to assume ${matchbox_http_endpoint}/assets/fedora/27
EOD
}
# machines # machines
# Terraform's crude "type system" does not properly support lists of maps so we do this. # Terraform's crude "type system" does not properly support lists of maps so we do this.
@ -82,8 +92,6 @@ EOD
default = "10.3.0.0/16" default = "10.3.0.0/16"
} }
# optional
variable "cluster_domain_suffix" { variable "cluster_domain_suffix" {
description = "Queries for domains with the suffix will be answered by kube-dns. Default is cluster.local (e.g. foo.default.svc.cluster.local) " description = "Queries for domains with the suffix will be answered by kube-dns. Default is cluster.local (e.g. foo.default.svc.cluster.local) "
type = "string" type = "string"