Skip to content

Commit

Permalink
simplify packer groups
Browse files Browse the repository at this point in the history
  • Loading branch information
sjpb committed Nov 5, 2024
1 parent f8d6505 commit fe1c6f1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/nightlybuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- ["update", "ofed", "cuda"]
exclude:
- source_image_name: Rocky-8-GenericCloud-Base-8.9-20231119.0.x86_64.qcow2
inventory_groups: ["update", "ofed", "cuda"]
inventory_groups: 'update,ofed,cuda'
env:
ANSIBLE_FORCE_COLOR: True
OS_CLOUD: openstack
Expand Down Expand Up @@ -89,7 +89,7 @@ jobs:
-var source_image_name=${{ matrix.source_image_name }} \
-var image_name_prefix=rocky-${{ matrix.os_version }} \
-var image_name_suffix=${{ env.IMAGE_NAME_SUFFIX }} \
-var 'inventory_groups=${{ toJSON(matrix.inventory_groups) }}' \
-var inventory_groups=${{ matrix.inventory_groups }} \
openstack.pkr.hcl
env:
PACKER_LOG: '1'
Expand Down
8 changes: 5 additions & 3 deletions packer/openstack.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ variable "metadata" {
}

variable "inventory_groups" {
type = list(string)
type = string
description = "comma-separated list of inventory groups, in addition to 'builder'"
default = []
}

Expand All @@ -157,6 +158,7 @@ variable "inventory_groups" {
variable "image_name_prefix" {
type = string
description = "Prefix for built image names"
# TODO: maybe we can just make this default to the first two parts of the source image name?
default = "openhpc"
}

Expand All @@ -171,7 +173,7 @@ source "openstack" "openhpc" {
flavor = var.flavor
use_blockstorage_volume = var.use_blockstorage_volume
volume_type = var.volume_type
volume_size = contains(var.inventory_groups, "cuda") ? var.volume_size_cuda : var.volume_size
volume_size = contains(split(",", var.inventory_groups), "cuda") ? var.volume_size_cuda : var.volume_size
metadata = var.metadata
instance_metadata = {ansible_init_disable = "true"}
networks = var.networks
Expand Down Expand Up @@ -206,7 +208,7 @@ build {

provisioner "ansible" {
playbook_file = "${var.repo_root}/ansible/fatimage.yml"
groups = concat(["builder"], var.inventory_groups)
groups = concat(["builder"], split(",", var.inventory_groups))
keep_inventory_file = true # for debugging
use_proxy = false # see https://www.packer.io/docs/provisioners/ansible#troubleshooting
extra_arguments = [
Expand Down

0 comments on commit fe1c6f1

Please sign in to comment.