mirror of
https://github.com/outbackdingo/matchbox.git
synced 2026-01-27 10:19:35 +00:00
examples/terraform: Rename coreos-install to container-linux-install
* Add container-linux-install profile to install Container Linux * Add cached-container-linux-install profile to install Container Linux from cached matchbox assets
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -32,5 +32,3 @@ bin/
|
||||
_output/
|
||||
tools/
|
||||
contrib/registry/data
|
||||
|
||||
terraform.tfvars
|
||||
|
||||
3
examples/terraform/.gitignore
vendored
3
examples/terraform/.gitignore
vendored
@@ -1,3 +1,4 @@
|
||||
*.tfstate*
|
||||
terraform.tfvars
|
||||
.terraform
|
||||
*.tfstate*
|
||||
assets
|
||||
|
||||
@@ -2,17 +2,18 @@
|
||||
module "profiles" {
|
||||
source = "../modules/profiles"
|
||||
matchbox_http_endpoint = "http://matchbox.example.com:8080"
|
||||
coreos_version = "1298.7.0"
|
||||
container_linux_version = "1298.7.0"
|
||||
container_linux_channel = "stable"
|
||||
}
|
||||
|
||||
// Install CoreOS to disk before provisioning
|
||||
// Install Container Linux to disk before provisioning
|
||||
resource "matchbox_group" "default" {
|
||||
name = "default"
|
||||
profile = "${module.profiles.coreos-install}"
|
||||
profile = "${module.profiles.cached-container-linux-install}"
|
||||
// No selector, matches all nodes
|
||||
metadata {
|
||||
coreos_channel = "stable"
|
||||
coreos_version = "1298.7.0"
|
||||
container_linux_channel = "stable"
|
||||
container_linux_version = "1298.7.0"
|
||||
ignition_endpoint = "http://matchbox.example.com:8080/ignition"
|
||||
baseurl = "http://matchbox.example.com:8080/assets/coreos"
|
||||
ssh_authorized_key = "${var.ssh_authorized_key}"
|
||||
@@ -67,4 +68,3 @@ resource "matchbox_group" "node3" {
|
||||
ssh_authorized_key = "${var.ssh_authorized_key}"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,17 +2,18 @@
|
||||
module "profiles" {
|
||||
source = "../modules/profiles"
|
||||
matchbox_http_endpoint = "http://matchbox.example.com:8080"
|
||||
coreos_version = "1298.7.0"
|
||||
container_linux_version = "1298.7.0"
|
||||
container_linux_channel = "stable"
|
||||
}
|
||||
|
||||
// Install CoreOS to disk before provisioning
|
||||
// Install Container Linux to disk before provisioning
|
||||
resource "matchbox_group" "default" {
|
||||
name = "default"
|
||||
profile = "${module.profiles.coreos-install}"
|
||||
profile = "${module.profiles.cached-container-linux-install}"
|
||||
// No selector, matches all nodes
|
||||
metadata {
|
||||
coreos_channel = "stable"
|
||||
coreos_version = "1298.7.0"
|
||||
container_linux_channel = "stable"
|
||||
container_linux_version = "1298.7.0"
|
||||
ignition_endpoint = "http://matchbox.example.com:8080/ignition"
|
||||
baseurl = "http://matchbox.example.com:8080/assets/coreos"
|
||||
ssh_authorized_key = "${var.ssh_authorized_key}"
|
||||
|
||||
@@ -21,7 +21,7 @@ storage:
|
||||
inline: |
|
||||
#!/bin/bash -ex
|
||||
curl "{{.ignition_endpoint}}?{{.request.raw_query}}&os=installed" -o ignition.json
|
||||
coreos-install -d /dev/sda -C {{.coreos_channel}} -V {{.coreos_version}} -i ignition.json {{if index . "baseurl"}}-b {{.baseurl}}{{end}}
|
||||
coreos-install -d /dev/sda -C {{.container_linux_channel}} -V {{.container_linux_version}} -i ignition.json {{if index . "baseurl"}}-b {{.baseurl}}{{end}}
|
||||
udevadm settle
|
||||
systemctl reboot
|
||||
passwd:
|
||||
@@ -29,3 +29,4 @@ passwd:
|
||||
- name: core
|
||||
ssh_authorized_keys:
|
||||
- {{.ssh_authorized_key}}
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
output "coreos-install" {
|
||||
value = "${matchbox_profile.coreos-install.name}"
|
||||
output "container-linux-install" {
|
||||
value = "${matchbox_profile.container-linux-install.name}"
|
||||
}
|
||||
|
||||
output "cached-container-linux-install" {
|
||||
value = "${matchbox_profile.cached-container-linux-install.name}"
|
||||
}
|
||||
|
||||
output "etcd3" {
|
||||
|
||||
@@ -1,17 +1,39 @@
|
||||
// CoreOS Install Profile
|
||||
resource "matchbox_profile" "coreos-install" {
|
||||
name = "coreos-install"
|
||||
kernel = "/assets/coreos/${var.coreos_version}/coreos_production_pxe.vmlinuz"
|
||||
// Container Linux Install profile (from release.core-os.net)
|
||||
resource "matchbox_profile" "container-linux-install" {
|
||||
name = "container-linux-install"
|
||||
kernel = "http://${var.container_linux_channel}.release.core-os.net/amd64-usr/${var.container_linux_version}/coreos_production_pxe.vmlinuz"
|
||||
|
||||
initrd = [
|
||||
"/assets/coreos/${var.coreos_version}/coreos_production_pxe_image.cpio.gz"
|
||||
"http://${var.container_linux_channel}.release.core-os.net/amd64-usr/${var.container_linux_version}/coreos_production_pxe_image.cpio.gz",
|
||||
]
|
||||
|
||||
args = [
|
||||
"coreos.config.url=${var.matchbox_http_endpoint}/ignition?uuid=$${uuid}&mac=$${mac:hexhyp}",
|
||||
"coreos.first_boot=yes",
|
||||
"console=tty0",
|
||||
"console=ttyS0"
|
||||
"console=ttyS0",
|
||||
]
|
||||
container_linux_config = "${file("${path.module}/cl/coreos-install.yaml.tmpl")}"
|
||||
|
||||
container_linux_config = "${file("${path.module}/cl/container-linux-install.yaml.tmpl")}"
|
||||
}
|
||||
|
||||
// Container Linux Install profile (from matchbox /assets cache)
|
||||
// Note: Admin must have downloaded container_linux_version into matchbox assets.
|
||||
resource "matchbox_profile" "cached-container-linux-install" {
|
||||
name = "cached-container-linux-install"
|
||||
kernel = "/assets/coreos/${var.container_linux_version}/coreos_production_pxe.vmlinuz"
|
||||
initrd = [
|
||||
"/assets/coreos/${var.container_linux_version}/coreos_production_pxe_image.cpio.gz",
|
||||
]
|
||||
|
||||
args = [
|
||||
"coreos.config.url=${var.matchbox_http_endpoint}/ignition?uuid=$${uuid}&mac=$${mac:hexhyp}",
|
||||
"coreos.first_boot=yes",
|
||||
"console=tty0",
|
||||
"console=ttyS0",
|
||||
]
|
||||
|
||||
container_linux_config = "${file("${path.module}/cl/container-linux-install.yaml.tmpl")}"
|
||||
}
|
||||
|
||||
// etcd3 profile
|
||||
|
||||
@@ -3,7 +3,12 @@ variable "matchbox_http_endpoint" {
|
||||
description = "Matchbox HTTP read-only endpoint (e.g. http://matchbox.example.com:8080)"
|
||||
}
|
||||
|
||||
variable "coreos_version" {
|
||||
type = "string"
|
||||
description = "CoreOS kernel/initrd version to PXE boot. Must be present in matchbox assets."
|
||||
variable "container_linux_version" {
|
||||
type = "string"
|
||||
description = "Container Linux version of the kernel/initrd to PXE or the image to install"
|
||||
}
|
||||
|
||||
variable "container_linux_channel" {
|
||||
type = "string"
|
||||
description = "Container Linux channel corresponding to the container_linux_version"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user