Skip to content

Commit a9be849

Browse files
committed
simplify packer groups
1 parent f8d6505 commit a9be849

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

.github/workflows/nightlybuild.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
- ["update", "ofed", "cuda"]
3232
exclude:
3333
- source_image_name: Rocky-8-GenericCloud-Base-8.9-20231119.0.x86_64.qcow2
34-
inventory_groups: ["update", "ofed", "cuda"]
34+
inventory_groups: 'update,ofed,cuda'
3535
env:
3636
ANSIBLE_FORCE_COLOR: True
3737
OS_CLOUD: openstack
@@ -89,7 +89,7 @@ jobs:
8989
-var source_image_name=${{ matrix.source_image_name }} \
9090
-var image_name_prefix=rocky-${{ matrix.os_version }} \
9191
-var image_name_suffix=${{ env.IMAGE_NAME_SUFFIX }} \
92-
-var 'inventory_groups=${{ toJSON(matrix.inventory_groups) }}' \
92+
-var inventory_groups=${{ matrix.inventory_groups }} \
9393
openstack.pkr.hcl
9494
env:
9595
PACKER_LOG: '1'

packer/openstack.pkr.hcl

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,9 @@ variable "metadata" {
138138
}
139139

140140
variable "inventory_groups" {
141-
type = list(string)
142-
default = []
141+
type = string
142+
description = "comma-separated list of inventory groups, in addition to 'builder'"
143+
default = ''
143144
}
144145

145146
# variable "groups" {
@@ -157,6 +158,7 @@ variable "inventory_groups" {
157158
variable "image_name_prefix" {
158159
type = string
159160
description = "Prefix for built image names"
161+
# TODO: maybe we can just make this default to the first two parts of the source image name?
160162
default = "openhpc"
161163
}
162164

@@ -171,7 +173,7 @@ source "openstack" "openhpc" {
171173
flavor = var.flavor
172174
use_blockstorage_volume = var.use_blockstorage_volume
173175
volume_type = var.volume_type
174-
volume_size = contains(var.inventory_groups, "cuda") ? var.volume_size_cuda : var.volume_size
176+
volume_size = contains(split(",", var.inventory_groups), "cuda") ? var.volume_size_cuda : var.volume_size
175177
metadata = var.metadata
176178
instance_metadata = {ansible_init_disable = "true"}
177179
networks = var.networks
@@ -206,7 +208,7 @@ build {
206208

207209
provisioner "ansible" {
208210
playbook_file = "${var.repo_root}/ansible/fatimage.yml"
209-
groups = concat(["builder"], var.inventory_groups)
211+
groups = concat(["builder"], split(",", var.inventory_groups))
210212
keep_inventory_file = true # for debugging
211213
use_proxy = false # see https://www.packer.io/docs/provisioners/ansible#troubleshooting
212214
extra_arguments = [

0 commit comments

Comments
 (0)