Skip to content

Commit 344d25b

Browse files
committed
Allow use of Ironic node name as instance name
This can be used in bare metal deployments where we may want the instance hostname to be exactly the same as the node name.
1 parent 92a73b7 commit 344d25b

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

environments/skeleton/{{cookiecutter.environment}}/tofu/compute.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ module "compute" {
2727
ignore_image_changes = lookup(each.value, "ignore_image_changes", false)
2828
match_ironic_node = lookup(each.value, "match_ironic_node", false)
2929
availability_zone = lookup(each.value, "availability_zone", "nova")
30+
use_ironic_node_name = lookup(each.value, "use_ironic_node_name", false)
3031

3132
# computed
3233
# not using openstack_compute_instance_v2.control.access_ip_v4 to avoid

environments/skeleton/{{cookiecutter.environment}}/tofu/node_group/nodes.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ resource "openstack_compute_instance_v2" "compute_fixed_image" {
5757

5858
for_each = var.ignore_image_changes ? toset(var.nodes) : []
5959

60-
name = "${var.cluster_name}-${each.key}"
60+
name = var.use_ironic_node_name ? "${each.key}" : "${var.cluster_name}-${each.key}"
6161
image_id = var.image_id
6262
flavor_name = var.flavor
6363
key_pair = var.key_pair
@@ -111,7 +111,7 @@ resource "openstack_compute_instance_v2" "compute" {
111111

112112
for_each = var.ignore_image_changes ? [] : toset(var.nodes)
113113

114-
name = "${var.cluster_name}-${each.key}"
114+
name = var.use_ironic_node_name ? "${each.key}" : "${var.cluster_name}-${each.key}"
115115
image_id = var.image_id
116116
flavor_name = var.flavor
117117
key_pair = var.key_pair

environments/skeleton/{{cookiecutter.environment}}/tofu/node_group/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,12 @@ variable "match_ironic_node" {
112112
default = false
113113
}
114114

115+
variable "use_ironic_node_name" {
116+
type = bool
117+
description = "Whether to name instances the same as the matching Ironic node (no cluster name)"
118+
default = false
119+
}
120+
115121
variable "availability_zone" {
116122
type = string
117123
description = "Name of availability zone - ignored unless match_ironic_node is true"

0 commit comments

Comments
 (0)