@@ -23,6 +23,7 @@ data "git-commit" "cwd-head" { }
23
23
locals {
24
24
git_commit = data. git-commit . cwd-head . hash
25
25
timestamp = formatdate (" YYMMDD-hhmm" , timestamp ())
26
+ image_name_version = var. image_name_version == " auto" ? " -${ local . timestamp } -${ substr (local. git_commit , 0 , 8 )} " : var. image_name_version
26
27
}
27
28
28
29
# Path pointing to root of repository - automatically set by environment variable PKR_VAR_repo_root
@@ -39,12 +40,6 @@ variable "networks" {
39
40
type = list (string )
40
41
}
41
42
42
- variable "os_version" {
43
- type = string
44
- description = " 'RL8' or 'RL9' with default source_image_* mappings"
45
- default = " RL9"
46
- }
47
-
48
43
# Must supply either source_image_name or source_image_id
49
44
variable "source_image_name" {
50
45
type = string
@@ -123,15 +118,6 @@ variable "volume_type" {
123
118
}
124
119
125
120
variable "volume_size" {
126
- type = map (number )
127
- default = {
128
- # fat image builds, GB:
129
- rocky-latest = 15
130
- openhpc = 15
131
- }
132
- }
133
-
134
- variable "extra_build_volume_size" {
135
121
type = number
136
122
default = 15
137
123
}
@@ -147,34 +133,35 @@ variable "metadata" {
147
133
}
148
134
149
135
variable "groups" {
150
- type = map (list (string ))
151
- description = " Additional inventory groups (other than 'builder') to add build VM to, keyed by source name"
152
- default = {
153
- # fat image builds:
154
- rocky-latest = [" update" ]
155
- openhpc = [" control" , " compute" , " login" ]
156
- }
136
+ type = string
137
+ description = " Comma-separated list of additional inventory groups (other than 'builder') to add build VM to"
138
+ default = " " # this is
139
+ # rocky-latest = ["update"]
140
+ # openhpc = ["control", "compute", "login"]
157
141
}
158
142
159
- variable "extra_build_groups" {
160
- type = list (string )
161
- default = []
143
+ variable "image_name" {
144
+ type = string
145
+ description = " Name of image"
146
+ default = " openhpc"
162
147
}
163
148
164
- variable "extra_build_image_name " {
149
+ variable "image_name_version " {
165
150
type = string
166
- description = " Infix for 'extra' build image name "
167
- default = " extra "
151
+ description = " Suffix for image name giving version. Default of 'auto' appends timestamp + short commit "
152
+ default = " auto "
168
153
}
169
154
170
155
source "openstack" "openhpc" {
171
156
# Build VM:
172
157
flavor = var. flavor
173
158
use_blockstorage_volume = var. use_blockstorage_volume
174
159
volume_type = var. volume_type
175
- volume_size = lookup ( var. volume_size , source . name , var . extra_build_volume_size )
160
+ volume_size = var. volume_size
176
161
metadata = var. metadata
177
- instance_metadata = {ansible_init_disable = " true" }
162
+ instance_metadata = {
163
+ ansible_init_disable = " true"
164
+ }
178
165
networks = var. networks
179
166
floating_ip_network = var. floating_ip_network
180
167
security_groups = var. security_groups
@@ -201,26 +188,25 @@ source "openstack" "openhpc" {
201
188
build {
202
189
203
190
# latest nightly image:
204
- source "source.openstack.openhpc" {
205
- name = " rocky-latest"
206
- image_name = " ${ source . name } -${ var . os_version } "
207
- }
191
+ # source "source.openstack.openhpc" {
192
+ # name = "rocky-latest"
193
+ # image_name = "${source.name}-${var.os_version}"
194
+ # }
208
195
209
196
# fat image:
210
197
source "source.openstack.openhpc" {
211
- name = " openhpc"
212
- image_name = " ${ source . name } -${ var . os_version } -${ local . timestamp } -${ substr (local. git_commit , 0 , 8 )} "
198
+ image_name = " ${ var . image_name } ${ local . image_name_version } "
213
199
}
214
200
215
- # Extended site-specific image, built on fat image:
216
- source "source.openstack.openhpc" {
217
- name = " openhpc-extra"
218
- image_name = " openhpc-${ var . extra_build_image_name } -${ var . os_version } -${ local . timestamp } -${ substr (local. git_commit , 0 , 8 )} "
219
- }
201
+ # # Extended site-specific image, built on fat image:
202
+ # source "source.openstack.openhpc" {
203
+ # name = "openhpc-extra"
204
+ # image_name = "openhpc-${var.extra_build_image_name}-${var.os_version}-${local.timestamp}-${substr(local.git_commit, 0, 8)}"
205
+ # }
220
206
221
207
provisioner "ansible" {
222
208
playbook_file = " ${ var . repo_root } /ansible/fatimage.yml"
223
- groups = concat ([" builder" ], lookup (var . groups , source . name , var. extra_build_groups ))
209
+ groups = concat ([" builder" ], split ( " , " , var. groups ))
224
210
keep_inventory_file = true # for debugging
225
211
use_proxy = false # see https://www.packer.io/docs/provisioners/ansible#troubleshooting
226
212
extra_arguments = [
0 commit comments