terraform: add no-reboot option

This commit is contained in:
Jörg Thalheim 2023-09-03 20:30:34 +02:00
parent bd3f79f11d
commit 2bc305e1cb
5 changed files with 17 additions and 0 deletions

View File

@ -29,6 +29,7 @@ module "install" {
disk_encryption_key_scripts = var.disk_encryption_key_scripts
extra_environment = var.extra_environment
instance_id = var.instance_id
no_reboot = var.no_reboot
}
module "nixos-rebuild" {

View File

@ -95,3 +95,9 @@ variable "extra_environment" {
description = "Extra environment variables to be set during installation. This can be usefull to set extra variables for the extra_files_script or disk_encryption_key_scripts"
default = {}
}
variable "no_reboot" {
type = bool
description = "Do not reboot after installation"
default = false
}

View File

@ -17,6 +17,7 @@ resource "null_resource" "nixos-remote" {
target_user = var.target_user
target_host = var.target_host
extra_files_script = var.extra_files_script
no_reboot = var.no_reboot
}, var.extra_environment)
command = "${path.module}/run-nixos-anywhere.sh ${join(" ", local.disk_encryption_key_scripts)}"
quiet = var.debug_logging

View File

@ -14,6 +14,9 @@ fi
if [[ ${kexec_tarball_url-} != "" ]]; then
args+=("--kexec" "${kexec_tarball_url}")
fi
if [[ ${no_reboot-} == "true" ]]; then
args+=("--no-reboot")
fi
args+=("--store-paths" "${nixos_partitioner}" "${nixos_system}")
tmpdir=$(mktemp -d)

View File

@ -77,3 +77,9 @@ variable "extra_environment" {
description = "Extra environment variables to be set during installation. This can be usefull to set extra variables for the extra_files_script or disk_encryption_key_scripts"
default = {}
}
variable "no_reboot" {
type = bool
description = "Do not reboot the machine after installation"
default = false
}