Skip to content
Snippets Groups Projects
Commit 1725f106 authored by Eesaan Atluri's avatar Eesaan Atluri
Browse files

Merge branch 'feat-add-base-compute-img' into 'main'

Rearrange tasks between roles to build a base image.

See merge request rc/packer-openstack-hpc-image!33
parents 93cd3e9a 6e0438c3
No related branches found
No related tags found
1 merge request!33Rearrange tasks between roles to build a base image.
......@@ -2,5 +2,5 @@
#This file path is relative to the ansible playbook.
pkg_list_file: "cheaha-compute-yum-pkg-list.txt"
lmod_db_host_machine: "ohpc"
lmod_db_host_machine: "cheaha-master01"
driver_run_file_link: "https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda_11.8.0_520.61.05_linux.run"
......@@ -3,4 +3,6 @@
hosts: default
become: true
roles:
- { name: 'cheaha.node', tags: 'cheaha.node' }
- { name: 'pam_slurm_adopt', tags: 'pam_slurm_adopt' }
- { name: 'lmod_user', tags: 'lmod_user'}
This contains packer hcl files for creating images. For documentation on packer, see [here](https://www.packer.io/docs); for information about the openstack-specific builder, see [here](https://www.packer.io/plugins/builders/openstack)
locals {
local_image_name = "${var.image_name}${var.image_date_suffix ? formatdate("YYYYMMDDHHmm", timestamp()): ""}"
}
source "openstack" "image" {
skip_create_image = var.skip_create_image
image_name = local.local_image_name
source_image_name = var.source_image
image_members = var.image_membership
image_auto_accept_members = var.auto_accept_members
image_tags = var.image_tags
flavor = var.flavor
instance_name = var.build_instance_name
floating_ip_network = var.floating_ip_network
networks = var.networks
security_groups = var.security_groups
ssh_username = var.ssh_username
}
build {
sources = ["source.openstack.image"]
provisioner "ansible" {
playbook_file = "./ansible/node-compute.yml"
roles_path = "./ansible/roles"
extra_arguments = [
"--extra-vars", "root_ssh_key='${var.root_ssh_key}'"
]
}
provisioner "ansible" {
playbook_file = "../CRI_XCBC/ood-packer.yaml"
ansible_env_vars = ["ANSIBLE_HOST_KEY_CHECKING=False"]
extra_arguments = [
"-t enable_lmod",
]
}
}
variable "root_ssh_key" {
type = string
description = "The root key to use for ssh"
}
variable "image_name" {
type = string
default = "cluster-image"
description = "Name of the image in openstack"
}
variable "image_date_suffix" {
type = bool
default = false
description = "Append a date to the image name (in YYYYMMDDHHMMSS format)"
}
variable "image_tags" {
type = list(string)
default = []
description = "List of tags to be associated to the resulting image"
}
variable "image_membership" {
type = list(string)
default = []
description = "Projects/tenants to share the image in openstack with"
}
variable "auto_accept_members" {
type = bool
default = false
description = "A boolean value for auto accepting image in the projects/tenants defined in image_membership."
}
variable "skip_create_image" {
type = bool
default = false
description = "A boolean value for skipping image creation at the end of the build"
}
variable "source_image" {
type = string
description = "The name of the source image to use"
}
variable "flavor" {
type = string
description = "The name of the flavor to use"
}
variable "floating_ip_network" {
type = string
description = "floating ip network to use with (temporary) ip assignmnet to a vm"
}
variable "networks" {
type = list(string)
description = "List of network UUIDs to assign to the network"
}
variable "security_groups" {
type = list(string)
default = []
description = "A list of security groups to add - you should make sure ssh access is open to the machine"
}
variable "build_instance_name" {
type = string
default = "compute"
description = "A name of build instance used for image build"
}
variable "ssh_username" {
type = string
default = "centos"
description = "The default username to use for SSH"
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment