Skip to content

Use of ephemeral SSH keys when building Packer images #274

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions environments/.stackhpc/builder.pkrvars.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ networks = ["a262aabd-e6bf-4440-a155-13dbc1b5db0e"] # WCDC-iLab-60
source_image_name = "openhpc-230503-0944-bf8c3f63.qcow2" # https://github.com/stackhpc/ansible-slurm-appliance/pull/252
fatimage_source_image_name = "Rocky-8-GenericCloud-8.6.20220702.0.x86_64.qcow2"
ssh_keypair_name = "slurm-app-ci"
ssh_private_key_file = "~/.ssh/id_rsa"
security_groups = ["default", "SSH"]
ssh_bastion_host = "128.232.222.183"
ssh_bastion_username = "slurm-app-ci"
3 changes: 2 additions & 1 deletion packer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ Building an environment-specific compute node image will[^1] require a cluster t
flavor = "general.v1.small" # VM flavor to use for builder VMs
networks = ["26023e3d-bc8e-459c-8def-dbd47ab01756"] # List of network UUIDs to attach the VM to
source_image_name = "Rocky-8.5-GenericCloud" # Name of source image. This must exist in OpenStack and should be a Rocky Linux 8.5 GenericCloud-based image.
ssh_keypair_name = "slurm-app-ci" # Name of an existing keypair in OpenStack. The private key must be on the host running Packer.
```

This configuration will generate and use an ephemeral SSH key for communicating with the Packer VM. If this is undesirable, set `ssh_keypair_name` to the name of an existing keypair in OpenStack. The private key must be on the host running Packer, and its path can be set using `ssh_private_key_file`.

The network used for the Packer VM must provide outbound internet access but does not need to provide access to resources which the final cluster nodes require (e.g. Slurm control node, network filesystem servers etc.).

For additional options such as non-default private key locations or jumphost configuration see the variable descriptions in `./openstack.pkr.hcl`.
Expand Down
3 changes: 2 additions & 1 deletion packer/openstack.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,12 @@ variable "ssh_username" {

variable "ssh_private_key_file" {
type = string
default = "~/.ssh/id_rsa"
default = null
}

variable "ssh_keypair_name" {
type = string
default = null
}

variable "security_groups" {
Expand Down