Skip to content

Commit 023c030

Browse files
committed
add docs for extra builds
1 parent 75b20fa commit 023c030

File tree

1 file changed

+38
-5
lines changed

1 file changed

+38
-5
lines changed

packer/README.md

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,46 @@ The steps for building site-specific fat images or extending an existing fat ima
3939
cd packer/
4040
PACKER_LOG=1 /usr/bin/packer build -only=openstack.openhpc --on-error=ask -var-file=$PKR_VAR_environment_root/builder.pkrvars.hcl openstack.pkr.hcl
4141
42-
Note that the `-only` flag here restricts the build to the non-OFED fat image "source" (in Packer terminology). Other
43-
source options are:
44-
- `-only=openstack.openhpc-ofed`: Build a fat image including Mellanox OFED
45-
- `-only=openstack.openhpc-extra`: Build an image which extends an existing fat image - in this case the variable `source_image` or `source_image_name}` must also be set in the Packer variables file.
46-
42+
Note that the `-only` flag here restricts the build to the non-OFED fat image "source" (in Packer terminology). Other
43+
source options are:
44+
- `-only=openstack.openhpc-ofed`: Build a fat image including Mellanox OFED
45+
- `-only=openstack.openhpc-cuda`: Build a fat image including Mellanox OFED, Nvidia drivers and CUDA
46+
- `-only=openstack.openhpc-extra`: Build an image which *extends* an existing fat image.
47+
4748
5. The built image will be automatically uploaded to OpenStack with a name prefixed `openhpc-` and including a timestamp and a shortened git hash.
4849
50+
# Defining an "extra" image build
51+
52+
An "extra" image build starts with an existing fat image (e.g. one provided by StackHPC) rather than a RockyLinux GenericCloud image, and only runs a specific subset of the
53+
Ansible in the appliance. This allows adding additional functionality into site-specific images, without modifying the existing functionality in the base fat image. This is the recommended way to build site-specific images.
54+
55+
To configure an "extra" image build, prepare a Packer variable definition file as described above. However this must additionally include:
56+
57+
- `extra_image_name`: A string to add into the final image name
58+
- `source_image` (or `source_image_name`): A map of strings keyed by RockyLinux variant, defining the base image.
59+
- `groups`: A mapping keyed by the build name defining the Ansible inventory groups which the build VM should be added to - which defines the roles/functionality which are
60+
added to the image.
61+
62+
E.g. to add the lustre client to an RockyLinux 9 image:
63+
64+
# environments/site/lustre.pkvars.hcl
65+
66+
extra_image_name = "lustre" # output image name will be like "openhpc-lustre-RL9-$timestamp-$commit"
67+
source_image = {
68+
# current StackHPC RL9 image:
69+
RL9 = "openhpc-ofed-RL9-240906-1041-32568dbb"
70+
}
71+
groups = {
72+
openhpc-extra = ["lustre"] # only run lustre role during this extra build
73+
}
74+
75+
... # define flavor, network, etc as normal
76+
77+
78+
Then, reference this file in the Packer build command:
79+
80+
PACKER_LOG=1 /usr/bin/packer build -only=openstack.openhpc-extra --on-error=ask -var-file=environments/site/lustre.pkvars.hcl openstack.pkr.hcl
81+
4982
# Build Process
5083
5184
In summary, Packer creates an OpenStack VM, runs Ansible on that, shuts it down, then creates an image from the root disk.

0 commit comments

Comments
 (0)