Skip to content

Commit 6680549

Browse files
authored
Merge pull request #269 from stackhpc/feat/packer-blockstorage
Support using volume-backed instances for building
2 parents af30b3c + 683539c commit 6680549

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

packer/openstack.pkr.hcl

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,32 @@ variable "floating_ip_network" {
101101
default = null
102102
}
103103

104+
variable "use_blockstorage_volume" {
105+
type = bool
106+
default = false
107+
}
108+
109+
variable "volume_size" {
110+
type = number
111+
default = null # When not specified use the size of the builder instance root disk
112+
}
113+
114+
variable "image_disk_format" {
115+
type = string
116+
default = null # When not specified use the image default
117+
}
118+
119+
variable "metadata" {
120+
type = map(string)
121+
default = {}
122+
}
123+
104124
source "openstack" "openhpc" {
105125
flavor = "${var.flavor}"
126+
volume_size = "${var.volume_size}"
127+
use_blockstorage_volume = "${var.use_blockstorage_volume}"
128+
image_disk_format = "${var.image_disk_format}"
129+
metadata = "${var.metadata}"
106130
networks = "${var.networks}"
107131
ssh_username = "${var.ssh_username}"
108132
ssh_timeout = "20m"
@@ -121,7 +145,7 @@ build {
121145
name = "compute"
122146
source_image = "${var.source_image}"
123147
source_image_name = "${var.source_image_name}" # NB: must already exist in OpenStack
124-
image_name = "ohpc-${source.name}-${local.timestamp}-${substr(local.git_commit, 0, 8)}.qcow2" # also provides a unique legal instance hostname (in case of parallel packer builds)
148+
image_name = "ohpc-${source.name}-${local.timestamp}-${substr(local.git_commit, 0, 8)}" # also provides a unique legal instance hostname (in case of parallel packer builds)
125149
}
126150

127151
provisioner "ansible" {
@@ -145,7 +169,7 @@ build {
145169
floating_ip_network = "${var.floating_ip_network}"
146170
source_image = "${var.fatimage_source_image}"
147171
source_image_name = "${var.fatimage_source_image_name}" # NB: must already exist in OpenStack
148-
image_name = "${source.name}-${local.timestamp}-${substr(local.git_commit, 0, 8)}.qcow2" # similar to name from slurm_image_builder
172+
image_name = "${source.name}-${local.timestamp}-${substr(local.git_commit, 0, 8)}" # similar to name from slurm_image_builder
149173
}
150174

151175
provisioner "ansible" {

0 commit comments

Comments
 (0)