Skip to content
Snippets Groups Projects
Commit 7542e18b authored by Chris King's avatar Chris King
Browse files

Do a semi-dirty hack and provide a copy to stage a gpu image directly

parent 657cdd75
No related branches found
No related tags found
No related merge requests found
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" {
image_name = local.local_image_name
source_image_name = var.source_image
flavor = var.flavor
floating_ip_network = var.floating_ip_network
networks = var.networks
security_groups = var.security_groups
ssh_username = var.ssh_username
}
# regular instance
build {
sources = ["source.openstack.image"]
provisioner "ansible" {
playbook_file = "./ansible/node-gpu.yml"
roles_path = "./ansible/roles"
extra_arguments = [
"--extra-vars", "root_ssh_key='${var.root_ssh_key}'"
]
}
}
variable "root_ssh_key" {
type = string
description = "The root key to use for ssh"
}
variable "image_name" {
type = string
default = "cluster-image-gpu"
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 "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 "ssh_username" {
type = string
default = "centos"
description = "The default username to use for SSH"
}
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"
}
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